I have a PDF builder application written in C++ Builder 10.3 that uses Debenu PDF Library DLL. The user fills in SQL data and uploads images. I create PDFs using the builder in pieces and then assemble them.
My issue is that with up to 30 .jpg files the resulting PDFs are too large to email. The user has to open each and "optimize" with Adobe.
I am looking for a way to automate the optimize process or perhaps resize the images when they are added to the photo PDFs. I am even trying to call all of the available compression routines but they seem to do nothing.
Code snippets below. Any help appreciated.
Thanks,
Gator
Code when adding an image to the PDF: DPL.AddImageFromFile(s_image_file.w_str(), 0); DPL.DrawImage(300, 110, 275, 275); DPL.DrawWrappedText(20,120, 270, s_image_desctiption.w_str()); DPL.AddImageFromFile(s_image_file.w_str(), 0); DPL.DrawImage(300, 415, 275, 275); DPL.DrawWrappedText(20,425, 270, s_image_desctiption.w_str()); DPL.CompressContent(); DPL.CompressImages(1); DPL.CompressFonts(1); DPL.SaveToFile(s_live_file.w_str());
This will create a 1 page PDF 2 images per page. I then merge all pages (report and images) together.
Code when combining all PDFs (including the one created above) into a single report PDF.
DebenuPDFLibraryDLL1611 DPL = DebenuPDFLibraryDLL1611::DebenuPDFLibraryDLL1611(L"DebenuPDFLibraryDLL1611.dll"); BSTR key=L"XXXXXXXXXXXXXXXXXXXXXXXX"; DPL.UnlockKey(key); int i = 0; int i_count = mPDFFileList->Count; while(i<i_count) { DPL.AddToFileList(L"FilesToMerge", mPDFFileList->Strings.w_str()); i++; } if(GetFileAttributesA(AnsiOf(s_diagram.c_str())) != INVALID_FILE_ATTRIBUTES) DPL.AddToFileList(L"FilesToMerge", s_diagram.w_str());
DPL.MergeFileList(L"FilesToMerge", s_full_report.w_str());
|