//Load the XFA document
PdfLoadedDocument lDoc = new PdfLoadedDocument(source);
//Create new document to save the imported document
PdfDocument document = new PdfDocument();
//Imports the pages from the lDoc
document.ImportPageRange(lDoc, 0, lDoc.Pages.Count - 1);
//Saves the document
document.Save("sample.pdf"); |
Hello, With your workaround, we can fill the PDF document and display it.But we still have the print problem : When we try to silently print the filled document, all fields are empty (but inserted images are present).Edit : Another question, how can i know that a PDF document is a XFA document ?I joined a PDF exemple to this message.Thanks in advance for your help, Best regards, Benjamin Attachment: cerfa2_1e165816.zip
private bool IsXFADocument (string filePath)
{
bool isXfa = false;
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(filePath);
//Get the loaded XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
int count = loadedForm.Fields.Count;
//If the loaded field count is greater than zero then its a XFA document.
if (count > 0)
isXfa = true;
return isXfa;
loadedDocument.Close();
} |
private bool IsXFADocument (string filePath)
{
bool isXfa = false;
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument(filePath);
//Get the loaded XFA form.
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
loadedDocument.Close();
int count = loadedForm.Fields.Count;
//If the loaded field count is greater than zero then its a XFA document.
if (count > 0)
isXfa = true;
return isXfa;
} |