You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by chitgoks <ch...@gmail.com> on 2017/06/05 23:47:32 UTC

square pdfbox ikvm

hi

has anyone used the .net version of pdfbox 1.8.9?

would like to ask about creating a rubber stamp how you did it

because the .net version relies heavily still on java classes and in this
case, it needs a bufferedimage and i have no idea how to do this. if this
was 2.0+ it would have been no problem, i was able to use LosslessFactory
to get a BufferedImage

thanks

Re: square pdfbox ikvm

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 06.06.2017 um 12:14 schrieb chitgoks:
> Okay. it seems that constructor does not work

That is because the PDPixelMap(PDStream) constructor assumes a stream 
like in a PDF. So that constructor is only used when opening PDFs. A 
"stream" is the actual pixel sequence, possibly compressed with one or 
more PDF filters (and there is no "png" filter).

That's why in the example I mentioned, there's this code:

BufferedImage awtImage = ImageIO.read(new File(imageFilename));
ximage = new PDPixelMap(document, awtImage);

Tilman

>
> but the other constructor where you pass a BufferedImage object instead of
> stream did the trick by using
>
> ImageIO.read(new ByteArrayInputStream(byteArray))
>
> On Tue, Jun 6, 2017 at 4:48 PM, chitgoks <ch...@gmail.com> wrote:
>
>> hi tilman ok thank you
>>
>> looks like some limitation for PDPixelMap probably
>>
>> i did a conversion from svg to png and the byte array output results in
>> blank when pdf is generated.
>>
>> PDXObjectImage imageSig = new PDPixelMap(new PDStream(pdfDocument, new
>> ByteArrayInputStream(byteArray)));
>>
>> the byte array is correct since it gets outputted correctly in java pdfbox
>> 2+
>>
>> On Tue, Jun 6, 2017 at 2:22 PM, Tilman Hausherr <TH...@t-online.de>
>> wrote:
>>
>>> Am 06.06.2017 um 01:47 schrieb chitgoks:
>>>
>>>> hi
>>>>
>>>> has anyone used the .net version of pdfbox 1.8.9?
>>>>
>>>> would like to ask about creating a rubber stamp how you did it
>>>>
>>>> because the .net version relies heavily still on java classes and in this
>>>> case, it needs a bufferedimage and i have no idea how to do this. if this
>>>> was 2.0+ it would have been no problem, i was able to use LosslessFactory
>>>> to get a BufferedImage
>>>>
>>>> thanks
>>>>
>>>> The class similar to LosslessFactory in 1.8 is PDPixelMap.
>>> There is a RubberStampWithImage.java example in the source code download.
>>>
>>> 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


Re: square pdfbox ikvm

Posted by chitgoks <ch...@gmail.com>.
Okay. it seems that constructor does not work

but the other constructor where you pass a BufferedImage object instead of
stream did the trick by using

ImageIO.read(new ByteArrayInputStream(byteArray))

On Tue, Jun 6, 2017 at 4:48 PM, chitgoks <ch...@gmail.com> wrote:

> hi tilman ok thank you
>
> looks like some limitation for PDPixelMap probably
>
> i did a conversion from svg to png and the byte array output results in
> blank when pdf is generated.
>
> PDXObjectImage imageSig = new PDPixelMap(new PDStream(pdfDocument, new
> ByteArrayInputStream(byteArray)));
>
> the byte array is correct since it gets outputted correctly in java pdfbox
> 2+
>
> On Tue, Jun 6, 2017 at 2:22 PM, Tilman Hausherr <TH...@t-online.de>
> wrote:
>
>> Am 06.06.2017 um 01:47 schrieb chitgoks:
>>
>>> hi
>>>
>>> has anyone used the .net version of pdfbox 1.8.9?
>>>
>>> would like to ask about creating a rubber stamp how you did it
>>>
>>> because the .net version relies heavily still on java classes and in this
>>> case, it needs a bufferedimage and i have no idea how to do this. if this
>>> was 2.0+ it would have been no problem, i was able to use LosslessFactory
>>> to get a BufferedImage
>>>
>>> thanks
>>>
>>> The class similar to LosslessFactory in 1.8 is PDPixelMap.
>>
>> There is a RubberStampWithImage.java example in the source code download.
>>
>> Tilman
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
>>
>

Re: square pdfbox ikvm

Posted by chitgoks <ch...@gmail.com>.
hi tilman ok thank you

looks like some limitation for PDPixelMap probably

i did a conversion from svg to png and the byte array output results in
blank when pdf is generated.

PDXObjectImage imageSig = new PDPixelMap(new PDStream(pdfDocument, new
ByteArrayInputStream(byteArray)));

the byte array is correct since it gets outputted correctly in java pdfbox
2+

On Tue, Jun 6, 2017 at 2:22 PM, Tilman Hausherr <TH...@t-online.de>
wrote:

> Am 06.06.2017 um 01:47 schrieb chitgoks:
>
>> hi
>>
>> has anyone used the .net version of pdfbox 1.8.9?
>>
>> would like to ask about creating a rubber stamp how you did it
>>
>> because the .net version relies heavily still on java classes and in this
>> case, it needs a bufferedimage and i have no idea how to do this. if this
>> was 2.0+ it would have been no problem, i was able to use LosslessFactory
>> to get a BufferedImage
>>
>> thanks
>>
>> The class similar to LosslessFactory in 1.8 is PDPixelMap.
>
> There is a RubberStampWithImage.java example in the source code download.
>
> Tilman
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Re: square pdfbox ikvm

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 06.06.2017 um 01:47 schrieb chitgoks:
> hi
>
> has anyone used the .net version of pdfbox 1.8.9?
>
> would like to ask about creating a rubber stamp how you did it
>
> because the .net version relies heavily still on java classes and in this
> case, it needs a bufferedimage and i have no idea how to do this. if this
> was 2.0+ it would have been no problem, i was able to use LosslessFactory
> to get a BufferedImage
>
> thanks
>
The class similar to LosslessFactory in 1.8 is PDPixelMap.

There is a RubberStampWithImage.java example in the source code download.

Tilman



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org