[reportlab-users] inserting image in dynamic .prep file without saving image first
andy at reportlab.com
Tue Sep 2 19:22:35 EDT 2014
Are you using z3c.rml?
This was not written by ReportLab and we do not support it. I think
it is likely they just haven't implemented that tag; you'd need to ask
the author(s). Try an evaluation copy of ReportLab PLUS to be
On 3 September 2014 00:08, David <ldl08 at gmx.net> wrote:
> Dear Robin,
> thank you for guiding me in the right direction. Seeking to take the
> next steps, I tried to create a basic rml file following your
> instructions (currently no preppy):
> <para style="textstyle1">
> <illustration height="200" width="150">
> <image file="" x="0" y="0">
> <inlineData filters="ascii85
> gzip">Gaob at B35f%hoFCm>=?Gi.rhAp;,b;f,==7C>I_7M'on0oMCEGjZHTBh:!;#n7qH68DOY<?C0#"@bDN`&TDSYY
> Now, running
> $ python trigger.py test_032_images_adapted.rml
> runs without an error message and creates a PDF (attached). However, it
> does not insert a graphic, just some text from the binary code.
> Without any error messages I am at a loss as to where to look for the
> problem. I assume my rml file to be faulty, but do not know how to
> proceed from here.
> I would greatly appreciate your insights and support!
> On 29/08/14 11:16, Robin Becker wrote:
>> On 29/08/2014 01:00, David wrote:
>>> Dear list,
>>> following this recipe ( http://stackoverflow.com/a/19160507 ), I am
>>> trying to emulate the "not saving an image on the hard disk" approach
>>> for z3c and preppy in an dynamic .prep file.
>>> I fail and hope for your wisdom.
>>> Two questions:
>>> a) what object type does z3c.rml expect for images?
>> I'm not exactly sure what's meant here: rml contains only text so unless
>> z3c.rml provides plugin flowables or graphics theres only text available.
>>> b) How would you suggest do I approach the goal of not saving images on
>>> my hard drive yet inserting them in a pdf via z3c?
>> in modern rml you can use an inlineData tag inside an image tag. Our
>> tests include this
>> <illustration height="200" width="150">
>> <image file="" x="0" y="0">
>> <inlineData filters="ascii85
>> gzip">Gaob at B35f%hoFCm>=?Gi.rhAp;,b;f,==7C>I_7M'on0oMCEGjZHTBh:!;#n7qH68DOY<?C0#"@bDN`&TDSYY(['=on[krFIEqTY4eZ:-1s\Q7i!$o?_#G/]#R#]D?n`E!JO#o*(^pV(_\!0-QBi:!M+"%6BJ^W[_-jNM*"IbEj0c;&#m>j?NXh1BeCE+"e'ldtf-c\O"pP9dL5
>> [U.b0P5FS5q at Ae$iXUOQR?/_]6\uD;_Wi*G.Y<&_n\uUU-5QCdGa-HhT~></inlineData>
>> so in your prep file you can just create the image as bytes and convert
>> to a readable form using various compressions and encodings. The dtd
>> says this
>> <!ELEMENT image (inlineData?)>
>> <!ATTLIST image
>> file CDATA #REQUIRED
>> x CDATA #REQUIRED
>> y CDATA #REQUIRED
>> width CDATA #IMPLIED
>> height CDATA #IMPLIED
>> inline CDATA #IMPLIED
>> transparency_mask CDATA "auto"
>> preserveAspectRatio (yes | no | 0 | 1) #IMPLIED
>> showBoundary (yes | no | 0 | 1) #IMPLIED
>> anchor (n|ne|e|se|s|sw|w|nw|c) #IMPLIED
>> pdfBoxType (MediaBox | CropBox| TrimBox | BleedBox | ArtBox) #IMPLIED
>> required (yes | no | 0 | 1 | true | false) "true"
>> alt_file CDATA #IMPLIED
>> type (pdf|bitmap) #IMPLIED
>> <!ELEMENT inlineData (#PCDATA)>
>> <!--inlineData filters is a space separated list of filters which are
>> applied in order
>> allowed filters are
>> base64 | ascii85 | bzip2 | gzip
>> <!ATTLIST inlineData
>> filters CDATA #REQUIRED
>> <!ELEMENT setFont EMPTY>
>> <!ATTLIST setFont
>> name CDATA #REQUIRED
>> size CDATA #REQUIRED
>> leading CDATA #IMPLIED
>>> Thanks for your guidance and creativity!
> reportlab-users mailing list
> reportlab-users at lists2.reportlab.com
ReportLab Europe Ltd.
Thornton House, Thornton Road, Wimbledon, London SW19 4NG, UK
More information about the reportlab-users