I've tried my best to combine all of the PDF demos to provide my users a mechanism to merge multiple different types of files (could be jpgs, gifs, bmps, and/or PDFs) into a PDF.
When the files are non-PDF only, it's quite good. But when the files are PDFs only or PDF + some images, the quality drops pretty significantly. I've tweaked the compression/paper sizes/margins, but can't find any combination that helps.
Image En 10.2.0 Delphi XE3
pdfBuilder := TIEPDFBuilder.Create;
try
imageIO := TImageEnIO.Create(nil);
try
imageIO.Params.PDF_Compression := ioPDF_LZW;
// imageIO.Params.PDF_PaperSize := paperSize;
// imageIO.Params.PDF_PageMargin := PDF_Page_Margin;
for TempDoc in aDocumentList do
begin
FileExtension := LowerCase(ExtractFileExt(TempDoc.FileName));
if FileExtension <> '.pdf' then
begin
imageIO.LoadFromFile(TempDoc.FileName);
pdfBuilder.AddPageWithImage(imageIO.IEBitmap, imageIO.Params);
end
else
begin
imageIO.LoadFromFilePDF(TempDoc.FileName);
imageIO.Seek(ieioSeekFirst);
pdfBuilder.AddPageWithImage(imageIO.IEBitmap, imageIO.Params);
idx := 0;
while imageIO.Seek( ieioSeekNext ) <> idx do
begin
pdfBuilder.AddPageWithImage(imageIO.IEBitmap, imageIO.Params);
inc(idx);
end;
end;
end;
finally
imageIO.Free;
end;
pdfBuilder.SaveToFile(FFilePathAndName);
finally
pdfBuilder.Free;
end;