Closed AbdesamedBendjeddou closed 2 years ago
I can reproduce the problem on a Windows 11 x64 virtual machine with rustc 1.60.0 and Pdfium 105.0.5117.0.
You are right that the underlying problem is the same, although it's not specific to translate()
. There are a number of FPDF_*
functions that return void rather than any particular return value; the FPDFPageObj_Transform()
function used in translate()
is one of those, but there are others. The idea is that, after calling these void-returning FPDF_*
functions, you then call FPDF_GetLastError()
to see if there was any problem with the previous call.
It's these calls to FPDF_GetLastError()
that are failing on Windows. If I comment out those calls to FPDF_GetLastError()
, the sample works fine and the before.pdf
file is created correctly, so there aren't any actual errors occurring, but FPDF_GetLastError()
is reporting that there are. Working on it.
On Linux and macOS, a call to FPDF_GetLastError()
after a successful operation consistently returns 0 (which is defined in the library as the constant FPDF_ERR_SUCCESS
), but on Windows the return value on success is undefined; in my testing, the return value was usually 487. In fairness, the documentation for FPDF_GetLastError()
at https://pdfium.googlesource.com/pdfium/+/refs/heads/main/public/fpdfview.h does state that "... if the previous SDK call succeeded, the return value of this function is not defined".
Adjusted PdfiumLibraryBindings::get_pdfium_last_error()
in bindings.rs to assume success on an undefined return value rather than failure.
Updated documentation. Bumped crate version to 0.7.5. Published to crates.io.
Please update to crate version 0.7.5 and confirm that the problem persists.
Yes, the problem is fixed! Thank you very much for your work
Excellent. Hopefully this gives you everything you need to complete your project.
There is one more problem, I'm opening an issue for it now
running these two programs seems to give a compile error on windows
since create_text_object() use translate() method in its definition I'm assuming that both errors are in fact the same. both programs compile fine on WSL It is worth mentioning that opening a file, removing text objects from it and saving the edited version worked fine. probably because we didn't need to use translate() method.