Giter Club home page Giter Club logo

Comments (6)

barteksc avatar barteksc commented on September 15, 2024 2

Sorry not mentioning it immediately. Thanks for update, I will pull it.

from pdfiumandroid.

barteksc avatar barteksc commented on September 15, 2024

Creating bitmap doesn't flatten pdf document. There is method for flattening in Pdfium, but it's not exposed in Java.

from pdfiumandroid.

matpag avatar matpag commented on September 15, 2024

I thought renderPageBitmap performed flattening + conversion to Bitmap all togheter.

What is the corresponding C++ method in the library to do this? (i don't know too much about C++ but if it's not too hard i can try to create a PR with a wrapper function for this feature)

PS: i've found it, should be this if i'm not wrong

from pdfiumandroid.

matpag avatar matpag commented on September 15, 2024

I've performed some researches and work, i've created a new method and in the last part of it (following the renderPageBitmap code) I've added the central lines.

....
FPDFBitmap_FillRect( pdfBitmap, baseX, baseY, baseHorSize, baseVerSize,
                     0xFFFFFFFF); //White

//flat the page before proceeding with Bitmap creation
const int result = FPDFPage_Flatten(page, flatType);
if (result == FLATTEN_FAIL){
    jniThrowException(env, "com/shockwave/pdfium/PdfiumCore", "PDF flattening has failed.");
}

FPDF_RenderPageBitmap( pdfBitmap, page,
                       startX, startY,
                       (int)drawSizeHor, (int)drawSizeVer,
                       0, flags );
.....

i've tried with 2 different sample PDF with form fields filled, but a the end i only get a PDF without them.
Maybe i need to save and reopen the document?
Any suggestions?

from pdfiumandroid.

barteksc avatar barteksc commented on September 15, 2024

Sorry, I forgot to mention that you should try using last parameter of .renderPage() method, which is boolean renderAnnot. It should render annotations and forms.

from pdfiumandroid.

matpag avatar matpag commented on September 15, 2024

Lol, now it's working fine passing true to the renderAnnot param.
I've wasted an evening working on something which was already working XD (at least i've learned something new 😋)
Btw thank you man, i've created a PR to update the example code to avoid future issues on the same thing

from pdfiumandroid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.