pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: PDBorderStyleDictionary.setWidth (was RE: QUADDING constants)
Date Sat, 09 Sep 2017 12:46:58 GMT
Done in https://issues.apache.org/jira/browse/PDFBOX-3929

Tilman

Am 08.09.2017 um 21:51 schrieb Tilman Hausherr:
> Ok, I got it:
> PDBorderStyleDictionary.setWidth() doesn't work at all in your example 
> because Adobe secretly wants integer numbers.
>
> However... in the AddAnnotations example, it is possible to use float 
> numbers and the effect is different (6 and 6.5) when displaying with 
> Adobe Reader.
>
> So maybe the effect is only with widget annotations (which are used 
> for Acroform).
>
> So I don't know what to do for now. You can either set the style 
> directly, or set a border array instead of the /BS. Maybe this should 
> be reported to Adobe. Or we should identify float numbers, and then 
> set an integer. Or include a warning in the javadoc. Or all of the 
> above...
> https://stackoverflow.com/questions/4727569/how-to-check-whether-input-value-is-integer-or-float

>
> https://stackoverflow.com/questions/5502548/checking-if-a-number-is-an-integer-in-java

>
>
> Tilman
>
>
> Am 07.09.2017 um 16:16 schrieb Gary Grosso:
>> Very sorry, I see that was confusing as heck. I must have overstayed 
>> my caffeine.
>>
>> I'm calling setQ with 0, 1, or 2 for now. End of subject.
>>
>>
>> New subject: PDBorderStyleDictionary.setWidth()
>>
>> It seems this produces output like 
>> http://aapro.net/PDF/BorderWeightTest.pdf but I need it to produce 
>> output like http://aapro.net/PDF/BorderWeightTestAcrobat.pdf in order 
>> for Acrobat/Reader to display different border thicknesses.
>>
>> I'm doing the following which makes Adobe products happy:
>>
>>      private static void setBorderWeight(PDBorderStyleDictionary 
>> borderStyle, String string) {
>>          int wt;
>>          try {
>>                  wt = Integer.parseInt(string);
>>          } catch (NumberFormatException exc) {
>>                  wt = 1;
>>          }
>>          COSDictionary dict = borderStyle.getCOSObject();
>>          dict.setInt("W", wt);
>>          //borderStyle.setWidth(wt);
>>      }
>>
>> Hopefully I'm making sense this time.
>>
>>
>> Thanks,
>> Gary
>>
>>
>>
>> -----Original Message-----
>> From: Tilman Hausherr [mailto:THausherr@t-online.de]
>> Sent: Thursday, September 7, 2017 2:29 AM
>> To: users@pdfbox.apache.org
>> Subject: Re: QUADDING constants
>>
>> ???
>>
>> Is this about width or about Q ?
>>
>> Tilman
>>
>> Am 06.09.2017 um 22:42 schrieb Gary Grosso:
>>> I can call PDBorderStyleDictionary.setWidth with 0, 1, or 2, for 
>>> now, but it looks to me like setWidth() sets the COSObject to a 
>>> float, e.g., 0.0, 1.0, etc., which Acrobat XI and Reader DC ignore. 
>>> It should be set to an integer.
>>>
>>> See http://aapro.net/PDF/BorderWeightTestAcrobat.pdf vs 
>>> aapro.net/PDF/BorderWeightTest.pdf.
>>>
>>> The BorderWeightTestAcrobat.pdf was created by opening 
>>> BorderWeightTest.pdf in Acrobat, setting the borders, and saving.
>>>
>>> It's a little awkward, since setWidth should really take an int 
>>> argument, not a float to begin with. The PDF spec, to my reading, is 
>>> looking for an integer number of points. So truly fixing it would 
>>> break any applications trying to pass in a float. OTOH, I don't see 
>>> how any such applications could be working, even though they'd 
>>> compile. I suppose non-Adobe PDF renderers might work with float data.
>>>
>>> Gary
>>>
>>> -----Original Message-----
>>> From: Tilman Hausherr [mailto:THausherr@t-online.de]
>>> Sent: Wednesday, September 6, 2017 12:48 PM
>>> To: users@pdfbox.apache.org
>>> Subject: Re: QUADDING constants
>>>
>>> Am 06.09.2017 um 17:11 schrieb Gary Grosso:
>>>> Thanks Tilman, I thought they were public but not visible, which 
>>>> was disturbing my fragile sense of competency.
>>> I first thought you were using Netbeans (which requires to press 
>>> CTRL SPACE twice to see the statics sometimes) but then I saw the 
>>> missing public. I'll create an issue later tonight or tomorrow 
>>> (unless you do) to put it back in. I don't see a reason why this was 
>>> removed.
>>>
>>> Tilman
>>>
>>>
>>>> -----Original Message-----
>>>> From: Tilman Hausherr [mailto:THausherr@t-online.de]
>>>> Sent: Wednesday, September 6, 2017 11:03 AM
>>>> To: users@pdfbox.apache.org
>>>> Subject: Re: QUADDING constants
>>>>
>>>> Am 06.09.2017 um 16:54 schrieb Gary Grosso:
>>>>> Sigh. This must be something about Java I need to understand 
>>>>> better. I get "The field PDVariableText.QUADDING_LEFT is not 
>>>>> visible".
>>>> You're right... these are not public. That explains why google 
>>>> found it only for an older version.
>>>>
>>>> Tilman
>>>>
>>>>
>>>>> -----Original Message-----
>>>>> From: Tilman Hausherr [mailto:THausherr@t-online.de]
>>>>> Sent: Wednesday, September 6, 2017 2:13 AM
>>>>> To: users@pdfbox.apache.org
>>>>> Subject: Re: QUADDING constants
>>>>>
>>>>> Am 06.09.2017 um 02:42 schrieb Gary Grosso:
>>>>>> PDVariableText.setQ (and various other methods) suggest seeing 
>>>>>> the "QUADDING constants".
>>>>>>
>>>>>> Can someone please post a link? Or tell me what class to look at?

>>>>>> I've searched, googled, etc., for close to a half hour. I suspect

>>>>>> this is something that everyone "just knows" but I have to admit

>>>>>> ignorance.
>>>>> It's also mentioned in the PDF 32000 specification:
>>>>>
>>>>> A code specifying the form of quadding (justification) that shall 
>>>>> be used in displaying the annotation's text:
>>>>> 0 Left-justified
>>>>> 1 Centered
>>>>> 2 Right-justified
>>>>> Default value: 0 (left-justified).
>>>>>
>>>>> And then I enter "PDVariableText quadding" (without quotes) in 
>>>>> google I find the constants that Andreas mentioned, although for 
>>>>> an older version. If you don't get these, check if some plugin 
>>>>> manipulated your browser's search results.
>>>>>
>>>>> Tilman
>>>>>
>>>>>
>>>>> --------------------------------------------------------------------
>>>>> - 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
>>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
>>>>
>>> ---------------------------------------------------------------------
>>> 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
>>>
>>
>> ---------------------------------------------------------------------
>> 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
>>
>
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message