Re: PDF problem - Help needed
Michael Sweet <[email protected]> Fri, 12 Sep 2025 12:02:49 -0400
| Newsgroups | dev.linux.lists.printing-architecture |
|---|---|
| Message-ID | <[email protected]> |
It might be that the content is being rendered off the page; the example = you supply would translate the content up 682.6 points (~241mm) and over = 253 points (~89mm). If the content is already located at this offset, = that would be enough to move it off the page... > On Sep 11, 2025, at 2:18=E2=80=AFPM, UDDHAV PHATAK 22BCE10731 = <[email protected]> wrote: >=20 > Hi Michael, > Thanks for the suggestion. following your suggestion, I realized I = wasn=E2=80=99t actually adding the stream into the page=E2=80=99s = content stream. After digging deeper into both my code and QPDF=E2=80=99s = implementation, I started creating a dedicated content stream for each = XObject. For example, for an XObject named Fxo1, I generated the = following stream: >=20 > ``` > q > 1.000000 0.000000 0.000000 1.000000 253.000000 682.600000 cm > /Fxo1 Do > Q > ``` > The transformation matrix values come directly from the /Rect of the = corresponding annotation object. I can now confirm that this stream is = indeed being appended to the page content stream. However, the XObject = still isn=E2=80=99t rendering or becoming visible in the output. >=20 >=20 > On Thu, Sep 11, 2025 at 8:32=E2=80=AFPM Michael Sweet = <[email protected]> wrote: > Till, >=20 > I don't have a lot of time to look at this right now, but from the = standpoint of adding the appearance streams as XObject resources in the = page dictionary, you still need to *draw* the objects from the page = content stream using the "Do" operator. For example, if the XObject was = named "foo" then you'd need to add: >=20 > /foo Do >=20 > to the content stream. >=20 >=20 > > On Sep 11, 2025, at 10:50=E2=80=AFAM, Till Kamppeter = <[email protected]> wrote: > >=20 > > [ This mail is addressed to people from whom I know that they have = konwledge on > > the inner workings of the PDF file format due to the projects they = are working > > on. ] > >=20 > > Hi, > >=20 > > Uddhav Phatak (CCed) has done a GSoC 2024 project on eliminating C++ = in libcupsfilters, mainly by replacing the PDF manipulator QPDF by Mike = Sweet's PDFio. > >=20 > > His project report: > >=20 > > = https://medium.com/@uddhavphatak/gsoc-2024-final-report-the-refactor-repor= t-a46756e9d6ce > >=20 > > His code as PR #71 on libcupsfilters: > >=20 > > https://github.com/OpenPrinting/libcupsfilters/pull/71 > >=20 > > Some parts he did not succeed to complete withing the GSoC time = frame due to their complexity. > >=20 > > What is remaining to be completed is flattening filled forms and = annotations into static content of the PDF, so that the filled in text = is correctly taken into account by doing page manipulations (like N-up) = and that it is assured that the text gets printed. > >=20 > > On this step Uddhav ran into a problem: > >=20 > > ----- > > Hi Till, > > I am not able to debug one issue, could you help me where I might be = going wrong, > >=20 > > form_english_filled.pdf and needtrue.pdf, both have needAppearances = set as true. > >=20 > > form_english_filled.pdf is successfully flattened as shown in = test.pdf > >=20 > > but when converting needtrue.pdf into needtrue-test.pdf, even though = all the annotation objects are successfully converted to Xobjects and = added into the page dict, I am not understanding why aren't they = visible. > >=20 > > Can you look through this and tell me where I might be going wrong, = and what value is missing from the Xobject Dictionary. > > ----- > >=20 > > The files mentioned here are all attached. > >=20 > > Anybody has an idea what can be wrong here? > >=20 > > Thanks in advance. > >=20 > > Till > > <test.pdf><needtrue-test.pdf><needtrue.pdf><form_english_filled.pdf> >=20 > ________________________ > Michael Sweet >=20 ________________________ Michael Sweet