-
Notifications
You must be signed in to change notification settings - Fork 58
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
Add support for extracting URIs from page link actions. #68
Comments
Hi @reyjexter, thank you for raising the issue. Pdfium defines two types of links, so let's just make sure we're talking about the same thing :)
I assume we're talking about the first type of link, not the second. You're right that the bindings to the FPDF_* functions related to links have already been added to Looking at the functions provided by Pdfium, it seems to me that |
PS I'm not sure I have a good sample document that has a bunch of links in it, so if you have some sample PDF files you can share, please do attach them to this issue. |
Thanks for the explanation on difference between the two and I think that is indeed the first one. I'm not particulary familiar with Pdfium yet but here's an example PDF: Note: I made edits and uploaded the file here instead. |
I made some changes on forked repo and on this commit which didn't have to use master...reyjexter:pdfium-render:master This only added extra function on an existing |
Yes, I think that's good. Just be aware that the URI text is actually 7-bit ASCII rather than UTF-16LE; no doubt your code works, but with a variety of string types supported by Pdfium, it may be worth updating your comments so as not to create confusion in future. Because the An example using the functionality is in |
Thanks for the this and as well as feedback and pointers. We will definitely be using the library that is released on from this main repository. Does the https://github.com/reyjexter/pdfium-render-wasm/blob/master/src/lib.rs Also, with this new functions, how are you able to find link(s) associated with an annotation? What we are trying to create is a struct of annotation text and link and return those information on browser together. Thanks again! |
Yes, all functionality should work on WASM except where explicitly marked otherwse. Let me see if I can reproduce the problem. To retrieve the link associated with a link annotation, you first get the annotation from So, for example, something like: for annotation in page.annotations().iter() {
if Some(annotation) = annotation.as_link_annotation() {
if Some(link) = annotation.link() {
// ... do something with the link ...
}
}
} The text content (if any) inside the annotation can be retrieved for all annotation types (not just link annotations) using |
The codes to extract link from an annotation works well. Thanks! |
I can reproduce your WASM problem. This was due to a small bug in memory allocation in the WASM implementation of |
Made small adjustments to documentation. Bumped crate version in |
Thanks and I can also confirm this works correctly now. |
Excellent. Publishing to crates.io as release 0.7.31. |
What's the correct way to extract links from page? There appears to be implementation of handling FPDFLink on bindings.rs already but it's not being used anywhere.
Thanks
The text was updated successfully, but these errors were encountered: