New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No image using XObject with PageModifier #277
Comments
Wonderful question! read more here: As an alternative you can make the call to creating the png form later, and use a previously allocated object ID that you allocate while writing the page content. i call this forward referencing, you can see an example here: |
Awesome, thanks! I think I'll use forward referencing since it'll make my code the cleanest. Is there any notable performance difference? I'm guessing the only difference is it changes the output slightly, putting all the images in one place in the binary - would that be correct? |
correct. nothing that should hurt you in terms of performance. |
I got it partially working. For now I'm just using the startContext() and endContext() functions. I made the assumption that I need to call getContext() again to update my context. The problem I'm having now is that, instead of rendering my images, my code is rendering semi-transparent black boxes in the wrong locations. This is how I'm getting a stream from my base64 image:
Is there anything obvious that I'm doing wrong? I tried writing a file using the same base64 data and that file works fine. I'm heading to sleep now but tomorrow I'll double-check that writing to a png file from the buffer I made works |
Try first to drop the cm. See that you get the images one on top of each other at top left corner. Continue fron there. Also try adding |
If you find the image is placed in wrong place, can you check the |
I'm attempting to render a PNG on a context given to me by a PageModifier. I believe I need to use
createFromXObjectFromPNG
because I eventually need to get my image from a stream rather than a file (as it's base64-encoded). Right now I'm testing it with a regular png file.I am not pausing the context because I don't know how to do that when using the page modifier. I tried using
pdfWriter.pausePageContentContext
, but this induces a segfault (I'm assuming because it was created with the modifier)This is how I'm attempting to render the image:
This snippet of code is being called inside the renderPage function of the follow code which instantiates the page modifier. It also draws a test image which gets rendered successfully.
The text was updated successfully, but these errors were encountered: