Return-Path: X-Original-To: apmail-pdfbox-users-archive@www.apache.org Delivered-To: apmail-pdfbox-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 395F2183BA for ; Fri, 14 Aug 2015 03:57:26 +0000 (UTC) Received: (qmail 10235 invoked by uid 500); 14 Aug 2015 03:57:26 -0000 Delivered-To: apmail-pdfbox-users-archive@pdfbox.apache.org Received: (qmail 10228 invoked by uid 500); 14 Aug 2015 03:57:26 -0000 Mailing-List: contact users-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@pdfbox.apache.org Delivered-To: mailing list users@pdfbox.apache.org Received: (qmail 10214 invoked by uid 99); 14 Aug 2015 03:57:25 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Aug 2015 03:57:25 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id A4DEBC20E5 for ; Fri, 14 Aug 2015 03:57:24 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.091 X-Spam-Level: *** X-Spam-Status: No, score=3.091 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, HTML_MESSAGE=3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_DKIM_INVALID=0.01, URIBL_BLOCKED=0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=neutral reason="invalid (public key: not available)" header.d=jahewson.com Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id 7uW94zVlOTYR for ; Fri, 14 Aug 2015 03:57:16 +0000 (UTC) Received: from mail-pa0-f45.google.com (mail-pa0-f45.google.com [209.85.220.45]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 25F73210C7 for ; Fri, 14 Aug 2015 03:57:15 +0000 (UTC) Received: by pacrr5 with SMTP id rr5so51295646pac.3 for ; Thu, 13 Aug 2015 20:57:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jahewson.com; s=google; h=from:content-type:message-id:mime-version:subject:date:references :to:in-reply-to; bh=WXZJFWYpmqesYPg16f/tfT/shUX23pXVSP4g6Bs92R4=; b=eONcARW6dzGyuzN8hsu5WhD3cks39vJ/UCgwfTxnceHS07pDNl9fJerCBnyVynZmZc R5HeHti9lUgfWuUCX3BuTSKdCNWiW2lsU2gPJnWqE98pgb8U+Dk4fOklVlT8yXBJSAE4 hp8WtNmZtqxyUuM9DfNJq2c1S8P7OOXfur8Wg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:content-type:message-id:mime-version :subject:date:references:to:in-reply-to; bh=WXZJFWYpmqesYPg16f/tfT/shUX23pXVSP4g6Bs92R4=; b=IzA0eU2ohh4aplnu9c6URgXbh3dD6VDPmaae/7IbQsdtnY6MOYvfDkTYiv/kvzAjkx hW0YBYHeSxzjNoGTcduc6z/TJoZBVCoEVDzZ9082TXXZ4fgThxkUC+KqCXRMC3ea6c1u 9fJcliu7GXl1l4/0pt8i1WSpzpRgPWyJLxNni0PLghtI8ZRyVPMFs3Oyx3G5TBx5DIdQ QiIxzk4CpW93XLY4Jx7riBryacMMbcebA91CvwinoiN8ybsfubGqMXpWEsuA1J39BsOY k3rAFs3RME7qoeseWUlHTjCzSEVLh3O+NorV4Z2+7JU/A7GRI1TRxOO+W7eiDu82bykm /K7Q== X-Gm-Message-State: ALoCoQmI+vWVx5JOLA8/ET5H7bAwIyHqrJTCk2oVbysEvnjURu8tgG16GritZFaBymP1JV/j6MdO X-Received: by 10.66.136.102 with SMTP id pz6mr84381946pab.52.1439524635439; Thu, 13 Aug 2015 20:57:15 -0700 (PDT) Received: from [10.0.1.12] (c-73-202-194-89.hsd1.ca.comcast.net. [73.202.194.89]) by smtp.gmail.com with ESMTPSA id w11sm4260612pbs.55.2015.08.13.20.57.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 13 Aug 2015 20:57:14 -0700 (PDT) From: John Hewson Content-Type: multipart/alternative; boundary="Apple-Mail=_E223230C-D8F0-4F06-A2B7-49A05858B3EB" Message-Id: <46B2A727-A6A5-49BC-830F-F96B7630CE27@jahewson.com> Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) Subject: Re: Rendering PDImageXObject Date: Thu, 13 Aug 2015 20:59:02 -0700 References: <9CE0932B-F9A3-4C11-BD77-0909F2D8797A@jahewson.com> <07F16A52-DCED-4E24-8093-1619CE2CE489@jahewson.com> To: users@pdfbox.apache.org In-Reply-To: X-Mailer: Apple Mail (2.2098) --Apple-Mail=_E223230C-D8F0-4F06-A2B7-49A05858B3EB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 13 Aug 2015, at 08:15, Kirk, Kenneth wrote: >=20 > When I create a PDF page and draw the image onto the page without any = scaling applied to the image, it is drawn at the DPI of the tiff, 200 = DPI in most instances. Later when I retrieve the PDFs and encounter a = PDF page has a image drawn on to it I won't know what DPI was used to = drawn the image on the page if it didn=E2=80=99t come from one of my = applications. When I render the image using defaults it is rendered at = 72 DPI which is the PDF default. So if the iamge was original drawn at = 200 DPI it would look larger than it really is. No problem for screen = viewing but a big problem for filming where space is at finite. Ok, to recap: you=E2=80=99re extracting an image which is drawn on a PDF = page and you=E2=80=99re wanting to know the size of the image relative = to the page. The embedded image itself is at a high resolution, so is = much bigger than the page if drawn without the appropriate scale. First of all, if your images are full page sized then you can simply = render the page with PDFBox at your chosen DPI and use the resulting = image instead. Otherwise, you=E2=80=99ll need to obtain the current transform matrix = (CTM) which is being used at the point that the image is drawn. If you = look at the ExtractImages example which ships with PDFBox, then in the = drawImages override you can add the following line to fetch this: Matrix ctm =3D getGraphicsState().getCurrentTransformationMatrix(); That matrix contains the scaling for the image, as well as any rotation = and skew. For x and y scalling, you want getScalingFactorX() and = getScalingFactorY(). Hope that helps, =E2=80=94 John > -----Original Message----- > From: John Hewson [mailto:john@jahewson.com]=20 > Sent: Wednesday, August 12, 2015 7:24 PM > To: users@pdfbox.apache.org > Subject: Re: Rendering PDImageXObject >=20 > Ok, that makes sense. Which part are you having a problem with? >=20 > =E2=80=94 John >=20 >> On 12 Aug 2015, at 07:31, Kirk, Kenneth wrote: >>=20 >> I'm doing both. I provide a service that takes tiff files from one = of the various processes we use to generate official documents and = converts them to PDFs so they can be stored in a document management = system. Then for archival purposes I have to take selected documents = from the document management system and convert them back to tiff so = they will run through the software/hardware that converts them to = microfilm for a disaster recovery policy requirement. >>=20 >> -----Original Message----- >> From: John Hewson [mailto:john@jahewson.com]=20 >> Sent: Tuesday, August 11, 2015 9:11 PM >> To: users@pdfbox.apache.org >> Subject: Re: Rendering PDImageXObject >>=20 >>=20 >>> On 11 Aug 2015, at 08:19, Kirk, Kenneth wrote: >>>=20 >>> John >>>=20 >>> 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. >>=20 >> I=E2=80=99m confused, you said you were converting TIFFs to PDF but = now you mention PDF pages from external sources? Are you reading the = PDFs or writing them? Did you mean that the TFF images come from an = external source? >>=20 >> =E2=80=94 John >>=20 >>> -----Original Message----- >>> From: John Hewson [mailto:john@jahewson.com]=20 >>> Sent: Monday, August 10, 2015 1:38 PM >>> To: users@pdfbox.apache.org >>> Subject: Re: Rendering PDImageXObject >>>=20 >>>=20 >>>> On 10 Aug 2015, at 05:58, Kirk, Kenneth wrote: >>>>=20 >>>> 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. >>>>=20 >>>=20 >>> You can draw the image with a scale of 72 / 200, in other words: >>>=20 >>> double dpi =3D 200; // you=E2=80=99ll want to fetch this from the = tiff content.drawImage(image, x, y, image.getWidth() * 72 / dpi, = image.getHeight() * 72 / dpi; >>>=20 >>> =E2=80=94 John >>> = --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org >>> For additional commands, e-mail: users-help@pdfbox.apache.org >>>=20 >>>=20 >>>=20 >>>=20 >>>=20 >>>=20 >>>=20 >>>=20 >>>=20 >>> ************************************************ >>> 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.=20 >>>=20 >>> 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.=20 >>> ************************************************ >>>=20 >>>=20 >>>=20 >>>=20 >>>=20 >>>=20 >>>=20 >>>=20 >>>=20 >>>=20 >>>=20 >>> = --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org >>> For additional commands, e-mail: users-help@pdfbox.apache.org >>>=20 >>=20 >>=20 >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org >> For additional commands, e-mail: users-help@pdfbox.apache.org >>=20 >>=20 >>=20 >>=20 >>=20 >>=20 >>=20 >>=20 >>=20 >> ************************************************ >> 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.=20 >>=20 >> 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.=20 >> ************************************************ >>=20 >>=20 >>=20 >>=20 >>=20 >>=20 >>=20 >>=20 >>=20 >>=20 >>=20 >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org >> For additional commands, e-mail: users-help@pdfbox.apache.org >>=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 > ************************************************ > 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.=20 >=20 > 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.=20 > ************************************************ >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org > For additional commands, e-mail: users-help@pdfbox.apache.org >=20 --Apple-Mail=_E223230C-D8F0-4F06-A2B7-49A05858B3EB--