Hello,
I have a problem when I try to convert a PDF file into
a Tiff file.
The scenario is:
I have a PDF file with XFA fields in it, I fill the
XFA Fields with a XML File.
Then I flat the Generate PDF file, this flatted file
looks good, with all fields and values in it.
Now I want to convert the flatted PDF file into a Tiff
Image, but not all fields an values are shown in the generated Tiff image.
I've tried the fowling code in version 9.6 and 9.7 of
aspose.pdf
License lic
= null;
lic = new
License();
lic.SetLicense("Aspose.Pdf.lic");
string
pdfTemplate = @"c:\temp\in.pdf";
string
xmlData = @"C:\temp\data.xml";
string
createdPDFFile = @"c:\temp\out.pdf";
string
flatPDFFile = @"c:\temp\flat2.pdf";
string
tifFilePath = @"C:\temp\out.tiff";
Document
pdfDocument = null;
System.IO.FileStream pdfFileStream = null;
System.IO.FileStream xmlFileStream = null;
Aspose.Pdf.Facades.Form form = null;
PdfConverter
pdfConverter = new PdfConverter();
TiffSettings
tiffSettings = new TiffSettings();
Aspose.Pdf.Devices.Resolution resolution = new
Aspose.Pdf.Devices.Resolution(600);
// Fill PDF
with data
pdfFileStream = new FileStream(pdfTemplate, FileMode.Open,
FileAccess.ReadWrite);
pdfDocument
= new Document(pdfFileStream);
xmlFileStream = new FileStream(xmlData, FileMode.Open);
form = new
Aspose.Pdf.Facades.Form(pdfDocument);
form.ImportXml(xmlFileStream);
pdfDocument.Save(createdPDFFile);
// Flat
document
pdfDocument
= new Document(createdPDFFile);
pdfDocument.Flatten();
pdfDocument.Form.Type =
Aspose.Pdf.InteractiveFeatures.Forms.FormType.Static;
pdfDocument.Save(flatPDFFile);
// Convert
to tiff
tiffSettings.Depth = Aspose.Pdf.Devices.ColorDepth.Default;
tiffSettings.Compression
= CompressionType.LZW;
tiffSettings.Depth = ColorDepth.Format8bpp;
tiffSettings.SkipBlankPages = false;
pdfConverter.Resolution = resolution;
pdfConverter.BindPdf(flatPDFFile);
pdfConverter.DoConvert();
pdfConverter.SaveAsTIFF(tifFilePath, PageSize.A4, tiffSettings);
I've attached my example PDF File to this entry.
Is there something wrong with my code, or is it a bug
in aspose.pdf?