Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 21769200D3C for ; Tue, 14 Nov 2017 12:50:41 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 18CD3160BF4; Tue, 14 Nov 2017 11:50:41 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5E3A41609EF for ; Tue, 14 Nov 2017 12:50:40 +0100 (CET) Received: (qmail 76640 invoked by uid 500); 14 Nov 2017 11:50:39 -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 76627 invoked by uid 99); 14 Nov 2017 11:50:38 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Nov 2017 11:50:38 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 231F61A1A7C for ; Tue, 14 Nov 2017 11:50:38 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.799 X-Spam-Level: X-Spam-Status: No, score=0.799 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id kTVU96kuSFf1 for ; Tue, 14 Nov 2017 11:50:34 +0000 (UTC) Received: from mail.bry.com.br (mail.bry.com.br [186.250.187.24]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 889CF5FE2F for ; Tue, 14 Nov 2017 11:50:33 +0000 (UTC) Received: (qmail 44744 invoked from network); 14 Nov 2017 11:50:23 +0000 Received: from mail.bry.com.br (HELO ?192.168.100.20?) (gabriel@bry.com.br@187.58.224.187) by mail.bry.com.br with SMTP; 14 Nov 2017 11:50:23 +0000 Subject: Re: Signature image not printing on Chrome To: users@pdfbox.apache.org References: <799e7b85-dca5-2c8e-a046-f89ccbb487e6@bry.com.br> <5eba1d65-cdb1-ee4d-b9a2-38f3fe389a89@bry.com.br> <0a72ba1a-41c8-c78f-0d3b-aed1013ff370@t-online.de> From: Gabriel Pessoa Message-ID: <5c9bc100-895f-fcaa-7a0b-f6885d72cb3e@bry.com.br> Date: Tue, 14 Nov 2017 09:50:22 -0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <0a72ba1a-41c8-c78f-0d3b-aed1013ff370@t-online.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: pt-BR archived-at: Tue, 14 Nov 2017 11:50:41 -0000 As a follow up to this question we created similar signatures with Adobe Reader and iText (both the latest versions, both able to print the signature image on Chrome) and inspected the generated PDFs. Looking at the AP dictionary I noticed that both write the BBox for the /N, /FRM and /img dictionaries different than PDFBox. For the /N and /FRM they both write [0, 0, width, height] the values being those from the rectangle where the image is set. For /img they calculate the scale factor relative between the image original size and the rectangle size. PDFBox uses by default for all three [100, 50, 0, 0] and that can be changed with PDVisibleSignDesigner.formatterRectangleParams(byte[]). Using that method (but passing 127 for width, because when i used 128 it wrote -128 on the PDF), the image was sucessfully printed from Chrome, although it does not fit the whole space, I believe because of the line "String imgFormContent    = "q " + 100 + " 0 0 50 0 0 cm /" + imageName.getName() + " Do Q\n";" in PDVisibleSigBuilder.injectAppearanceStreams. And just to pinpoint the exact BBox, i downloaded PDFBox from 2.0.9 -SNAPSHOT and changed the code so that only the BBox from PDFTemplateBuilder.createHolderForm receives the value set in formatterRectangleParams(byte[]) and I was able to print the signature image. I'm curious why PDFBox uses [100, 50, 0, 0] as the BBox, because for what i understood according to the PDF spec is that it represents the lower left (in this case x=100, y=50) and upper right corners (x=0, y=0) of what is being drawn. The original and signed files that i used for this can be found at: https://drive.google.com/open?id=0B2hR5R90BDFQZzkwSHEzTVEwSDQ Em 27/10/2017 17:15, Tilman Hausherr escreveu: > it's a known problem in chrome: > https://bugs.chromium.org/p/pdfium/issues/detail?id=643 > > it's a known problem in firefox: > https://github.com/mozilla/pdf.js/issues/4743 > > Tilman > > Am 27.10.2017 um 21:02 schrieb Gabriel Pessoa: >> Just to clarify, the problem was detected with a client that prefers >> to download and print their signed PDFs directly from Chrome. >> >> On Edge the image is printed no problem and Firefox is the same as >> Chrome. >> >> >> Em 27/10/2017 16:57, Gabriel Pessoa escreveu: >>> Hello everyone I have a problem that is bugging me for the last >>> couple of days. >>> >>> When we sign any PDF with a image associated and then we open the >>> signed PDF on Chrome and try to print from it, the image does not >>> appears. >>> >>> I tried PDFs generated with the HelloWorld example, exported from >>> Word, BIRT Report Engine and AsposePdf and the result was the same. >>> We have applications running PDFBox 1.8.13 (legacy, soon to be >>> discontinued) and 2.0.7, and in both the situation occurs. >>> >>> It is possible to replicate the problem with the example for visual >>> signature on the example directory. In any case the original file >>> and the signed one can be found here: >>> https://drive.google.com/open?id=0B2hR5R90BDFQZzkwSHEzTVEwSDQ >>> >>> Thanks in advance for any help that you guys can give. >>> >>> Att, >>> >>> Gabriel Pessoa >>> Analista >>> BRy Tecnologia >>> Rua Lauro Linhares, 2123 Torre B - 3º andar >>> 88036-002 - Florianópolis - SC - Brasil >>> +55 (48) 3234 6696 >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org >>> For additional commands, e-mail: users-help@pdfbox.apache.org >>> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org > For additional commands, e-mail: users-help@pdfbox.apache.org > -- Atenciosamente, Gabriel Pessoa Analista BRy Tecnologia Rua Lauro Linhares, 2123 Torre B - 3º andar 88036-002 - Florianópolis - SC - Brasil +55 (48) 3234 6696 --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org For additional commands, e-mail: users-help@pdfbox.apache.org