John How would I know what DPI the image was drawn with? Some of the PDF pages come from source outside of my control but I have to extract them just the same.
-----Original Message----- From: John Hewson [mailto:[email protected]] Sent: Monday, August 10, 2015 1:38 PM To: [email protected] Subject: Re: Rendering PDImageXObject > On 10 Aug 2015, at 05:58, Kirk, Kenneth <[email protected]> wrote: > > I have a situation that maybe someone has already solved in a more efficient > manner. When converting a tiff image to PDF I use the drawImage method of > the PDPageContentStream. The tiff image has a resolution of 200 DPI which is > 1700x2200. When PDFRenderer renders this image from the resulting PDF page > it does so at the PDF default of 72 DPI which logically translates to page 23 > inches by 30 inches when applied to the original iamge size of 1700x2200. > Since I don't know after the fact what DPI a image object on PDF page was > drawn at I came up with down scaling the image at PDF creation time to 72 > DPI. I'm sure there must a better way one of you computer science PHDs have > come up with. > You can draw the image with a scale of 72 / 200, in other words: double dpi = 200; // you’ll want to fetch this from the tiff content.drawImage(image, x, y, image.getWidth() * 72 / dpi, image.getHeight() * 72 / dpi; — John --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] ************************************************ Disclaimer - This email and any files transmitted with it are confidential and contain privileged or copyright information. You must not present this message to another party without gaining permission from the sender. If you are not the intended recipient you must not copy, distribute or use this email or the information contained in it for any purpose other than to notify the Office of the Illinois Secretary of State. If you have received this message in error, please notify the sender immediately, and delete this email from your system. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of the Office of the Illinois Secretary of State. ************************************************

