Re: inserting image in dynamic .prep file without saving image first
Andy Robinson <[email protected]>
| Newsgroups | gmane.comp.python.reportlab.user |
|---|---|
| Message-ID | <CABjtApsgAOQGy73RXr5bAMVyM+LLfk-pZzwYFTYRLgypsL=n6A@mail.gmail.com> |
Hi David, 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 sure.... - Andy On 3 September 2014 00:08, David <[email protected]> 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@B35f%hoFCm>=?Gi.rhAp;,b;f,==7C>I_7M'on0oMCEGjZHTBh:!;#n7qH68DOY<?C0#"@bDN`&TDSYY > > [...] > > </inlineData> > </image> > </illustration> > > </para> > > 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! > > Cheers, > > David > > > 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@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@Ae$iXUOQR?/_]6\uD;_Wi*G.Y<&_n\uUU-5QCdGa-HhT~></inlineData> >> >> </image> >> </illustration> >> >> 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! >>> >>> David >> .... >> > > > _______________________________________________ > reportlab-users mailing list > [email protected] > http://two.pairlist.net/mailman/listinfo/reportlab-users > -- Andy Robinson Managing Director ReportLab Europe Ltd. Thornton House, Thornton Road, Wimbledon, London SW19 4NG, UK Tel +44-20-8405-6420