You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Markus Ruggiero <ma...@kataputt.com> on 2021/03/26 13:45:25 UTC

Embed image from database, not from file

Folks,

I have image data stored in a database, not as a file. It is JPEG data in Base64 encoding. My understanding is that with fo.external-graphic I can only use a proper file url for the image reference - but there is no file in my case. Is there any other way to embed image data in the PDF output? Can I somehow put the image data into the input xml data file and pull it from there?

Thanks for any help
---markus---
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Embed image from database, not from file

Posted by Csaba Nánai <sz...@gmail.com>.
Hi,

An example for data url u can see at
https://stackoverflow.com/questions/8499633/how-to-display-base64-images-in-html

Best regards, Csaba

DSM@rucotec.ch <ds...@rucotec.ch> ezt írta (időpont: 2021. márc. 29., H,
9:27):

>
> > On 26 Mar 2021, at 15:08, Simon Steiner <si...@gmail.com>
> wrote:
> >
> > Hi,
> >
> > The uri can be a data url also
> >
>
> Sounds great. How would that look like? How would I embed the data in the
> xml and then reference from xsl?
> Thanks a lot
>
> > Thanks
> >
> > -----Original Message-----
> > From: Markus Ruggiero <ma...@kataputt.com>
> > Sent: 26 March 2021 13:45
> > To: fop-users@xmlgraphics.apache.org
> > Subject: Embed image from database, not from file
> >
> > Folks,
> >
> > I have image data stored in a database, not as a file. It is JPEG data in
> > Base64 encoding. My understanding is that with fo.external-graphic I can
> > only use a proper file url for the image reference - but there is no
> file in
> > my case. Is there any other way to embed image data in the PDF output?
> Can I
> > somehow put the image data into the input xml data file and pull it from
> > there?
> >
> > Thanks for any help
> > ---markus---
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>

Re: Embed image from database, not from file

Posted by "DSM@rucotec.ch" <ds...@rucotec.ch>.
> On 26 Mar 2021, at 15:08, Simon Steiner <si...@gmail.com> wrote:
> 
> Hi,
> 
> The uri can be a data url also
> 

Sounds great. How would that look like? How would I embed the data in the xml and then reference from xsl?
Thanks a lot

> Thanks
> 
> -----Original Message-----
> From: Markus Ruggiero <ma...@kataputt.com> 
> Sent: 26 March 2021 13:45
> To: fop-users@xmlgraphics.apache.org
> Subject: Embed image from database, not from file
> 
> Folks,
> 
> I have image data stored in a database, not as a file. It is JPEG data in
> Base64 encoding. My understanding is that with fo.external-graphic I can
> only use a proper file url for the image reference - but there is no file in
> my case. Is there any other way to embed image data in the PDF output? Can I
> somehow put the image data into the input xml data file and pull it from
> there?
> 
> Thanks for any help
> ---markus---
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 


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


RE: Embed image from database, not from file

Posted by Simon Steiner <si...@gmail.com>.
Hi,

 

Something like this:

<fo:block><fo:external-graphic src="url('data:application/pdf;base64,data')"
/></fo:block>

 

Thanks

 

From: Markus Ruggiero <ma...@kataputt.com> 
Sent: 26 March 2021 14:44
To: fop-users@xmlgraphics.apache.org
Subject: Re: Embed image from database, not from file

 

Sounds great. How would that look like? How would I embed the data in the
xml and then reference from xsl?
Thanks a lot





On 26 Mar 2021, at 15:08, Simon Steiner <simonsteiner1984@gmail.com
<ma...@gmail.com> > wrote:

 

Hi,

The uri can be a data url also

Thanks

-----Original Message-----
From: Markus Ruggiero <mailinglists@kataputt.com
<ma...@kataputt.com> > 
Sent: 26 March 2021 13:45
To: fop-users@xmlgraphics.apache.org
<ma...@xmlgraphics.apache.org> 
Subject: Embed image from database, not from file

Folks,

I have image data stored in a database, not as a file. It is JPEG data in
Base64 encoding. My understanding is that with fo.external-graphic I can
only use a proper file url for the image reference - but there is no file in
my case. Is there any other way to embed image data in the PDF output? Can I
somehow put the image data into the input xml data file and pull it from
there?

Thanks for any help
---markus---
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
<ma...@xmlgraphics.apache.org> 
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
<ma...@xmlgraphics.apache.org> 



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
<ma...@xmlgraphics.apache.org> 
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
<ma...@xmlgraphics.apache.org> 

 


Re: Embed image from database, not from file

Posted by Markus Ruggiero <ma...@kataputt.com>.
Sounds great. How would that look like? How would I embed the data in the xml and then reference from xsl?
Thanks a lot

> On 26 Mar 2021, at 15:08, Simon Steiner <si...@gmail.com> wrote:
> 
> Hi,
> 
> The uri can be a data url also
> 
> Thanks
> 
> -----Original Message-----
> From: Markus Ruggiero <ma...@kataputt.com> 
> Sent: 26 March 2021 13:45
> To: fop-users@xmlgraphics.apache.org
> Subject: Embed image from database, not from file
> 
> Folks,
> 
> I have image data stored in a database, not as a file. It is JPEG data in
> Base64 encoding. My understanding is that with fo.external-graphic I can
> only use a proper file url for the image reference - but there is no file in
> my case. Is there any other way to embed image data in the PDF output? Can I
> somehow put the image data into the input xml data file and pull it from
> there?
> 
> Thanks for any help
> ---markus---
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 


RE: Embed image from database, not from file

Posted by Simon Steiner <si...@gmail.com>.
Hi,

The uri can be a data url also

Thanks

-----Original Message-----
From: Markus Ruggiero <ma...@kataputt.com> 
Sent: 26 March 2021 13:45
To: fop-users@xmlgraphics.apache.org
Subject: Embed image from database, not from file

Folks,

I have image data stored in a database, not as a file. It is JPEG data in
Base64 encoding. My understanding is that with fo.external-graphic I can
only use a proper file url for the image reference - but there is no file in
my case. Is there any other way to embed image data in the PDF output? Can I
somehow put the image data into the input xml data file and pull it from
there?

Thanks for any help
---markus---
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org



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


Re: Embed image from database, not from file

Posted by Chris Bowditch <bo...@hotmail.com>.
Hi,

yes you can use data URI to avoid saving it to a file

Thanks,

Chris

On 26/03/2021 13:45, Markus Ruggiero wrote:
> Folks,
>
> I have image data stored in a database, not as a file. It is JPEG data in Base64 encoding. My understanding is that with fo.external-graphic I can only use a proper file url for the image reference - but there is no file in my case. Is there any other way to embed image data in the PDF output? Can I somehow put the image data into the input xml data file and pull it from there?
>
> Thanks for any help
> ---markus---
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
> .



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