Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Decrease PDF size. Compress images?
Re: Decrease PDF size. Compress images? [message #49438 is a reply to message #49437] Fri, 09 February 2018 17:41 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
shockjockey wrote on Fri, 09 February 2018 15:38
Hello all!

I am working on a converter that will extract and stitch a number of JPG files together into a single PDF file and lay text on top of it. This works fine but my problem is that the PDF file is very big, about 5 to 10 times the size of the JPG files combined. I wondered if I should take a different approach or could add some code to compress the images in the resulting PDF?\

This is a simplified code example of what I am doing so far:

Image img = StreamRaster::LoadStringAny("C:\\path\\to\\jpg.jpg");

Report r;
				
r.SetPageSize(img.GetWidth(), img.GetHeight());
				
r.DrawImage(0, 0, img);

String pdf_contents = Pdf(r);

SaveFile("C:\\path\\to\\pdf.pdf", pdf_contents);


Thanks in advance for any pointers in the right direction that you might be able to give me!


Well, this is a tiny bit beyond what PdfDraw can do. We will need to add some direct JPG support to PdfDraw to allow this.

Which might not be that hard actually, this can help:

https://blog.idrsolutions.com/2011/07/extract-raw-jpeg-image s-from-a-pdf-file/
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Loses qualifiers const in Size Image::GetDPI(void)
Next Topic: What is the best way to handle scaling icons?
Goto Forum:
  


Current Time: Thu May 16 21:10:50 CEST 2024

Total time taken to generate the page: 0.01874 seconds