| PDFsharp & MigraDoc Forum https://forum.pdfsharp.net/ |
|
| Get Location & width (x, y) of existing images from existing https://forum.pdfsharp.net/viewtopic.php?f=2&t=2040 |
Page 1 of 1 |
| Author: | Equusoft [ Mon Jun 04, 2012 10:54 pm ] |
| Post subject: | Get Location & width (x, y) of existing images from existing |
Good evening everyone. I am working on a project where we will be resampling the images in an existing PDF document. Our goal is to reduce the overall file size. I have poured over the forum and the wiki, and have seen the examples for extracting the image from the file. I even have some working code that replaces the JPEGs (streams) in my test document. However, I also need the image's height and width so that I can resample the image to the "native" document DPI. What is the best way to find the XY coordinates and more importantly, the Height and Width of an image when opening the document in SharpPDF? Thank you in advance! |
|
| Author: | Equusoft [ Mon Jun 04, 2012 10:57 pm ] |
| Post subject: | Re: Get Location & width (x, y) of existing images from exis |
Oh, just to clairify; I am looking for the layout height/width and position, and not the image's native resolution. Thanks! |
|
| Author: | Thomas Hoevel [ Tue Jun 05, 2012 7:55 am ] |
| Post subject: | Re: Get Location & width (x, y) of existing images from exis |
Hi! Equusoft wrote: What is the best way to find the XY coordinates and more importantly, the Height and Width of an image when opening the document in SharpPDF? I don't know. Maybe you should ask in the SharpPDF forum (if there is any).Position and dimensions are specified when the image is actually drawn on a page. AFAIK PDFsharp does not parse the drawing instructions for you. PDFsharp gives you the stream of drawing instructions, but you have to do the parsing. Probably not a simple task, IIRC PDF files can contain various transformations that affect position, dimensions, and even shape of images. See page 5 of the Graphics sample: http://www.pdfsharp.net/wiki/Graphics-sample.ashx |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|