Hi All,
We are currently using PDFNet Mobile SDK for Xamarin.Android & Xamarin.iOS and created new xamarin forms app(PCL). I have some questions for this SDK.
1.How to load a xod file(dynamic s3 url) or load a pdf file(dynamic s3 url)?
Note: I have sample code from our end.it's working as expected(static file).
sample code.
Stream fis = this.Resources.OpenRawResource(Resource.Raw.sample);
PDFDoc docToOpen = new PDFDoc(fis);
Please send me sample code(C#) for load dynamic file ASAP.
To open a PDF, you can use PDFViewCtrl.OpenUrl() to open a PDF located on a server.
Ideally the PDF was saved as linearized (Fast Web View), and the server hosting the PDF file supports byte-range request headers.
As for XOD files, yes you can download them locally on the device, and then call Convert.FromXPS, which gives a PDF, and then open that locally. This would be slower than the above solution.
How to apply the watermark when a user requests the file(dynamic watermark) using xamarin forms?
Are you looking to add the watermark to the PDF itself (modify the PDF), or as some sort of overlay that is not part of the PDF?
How to load annotation string(xfdfString from xod) into xamarin forms?
FDFDoc fdf_doc = new FDFDoc(FDFDoc.CreateFromXFDF(xml_xfdf_string)); pdf_doc.FDFMerge(fdf_doc);
When are you trying to merge the XFDF? Doing it server side is common action.
Or are you looking to do this client side, along with using PDFViewCtrl.OpenUrlAsync?
Thanks Ryan, Question 1: Are you looking to add the watermark to the PDF itself (modify the PDF), or as some sort of overlay that is not part of the PDF? Ans.I want to overlay text onto the PDF with using PDFViewCtrl.OpenUrlAsync.
Question 2: When are you trying to merge the XFDF? Doing it server side is common action.
Or are you looking to do this client side, along with using PDFViewCtrl.OpenUrlAsync? Ans.Yes,we are looking to do this client side, along with using PDFViewCtrl.OpenUrlAsync.
Question 1: Are you looking to add the watermark to the PDF itself (modify the PDF), or as some sort of overlay that is not part of the PDF? Ans.I want to overlay text onto the PDF with using PDFViewCtrl.OpenUrlAsync.
In this case using AddSubView that’s full screen on top of PDFViewCtrl should work for what you want.
Question 2: When are you trying to merge the XFDF? Doing it server side is common action. Ans.Yes,we are looking to do this client side, along with using PDFViewCtrl.OpenUrlAsync.
The easiest thing to do is wait for the document to be fully downloaded, then merge and update PDFViewCtrl.
You would listen for the PDFViewCtrl.DocumentDownloaded event, then you would do something along the following.
Hi Ryan,
1.In this case using AddSubView that’s full screen on top of PDFViewCtrl should work for what you want. Ans.can you please send me a sample code using AddSubView.
we have used PDFViewCtrl.DocumentDownloaded event,But i got error on mPdfViewCtrl.getDoc().fdfMerge(fdfdoc) in andoid.
i have sample code for your refrence.
For #2, FDFMerge works on the entire document, so you need to wait till the entire document is downloaded. Or you would have to pre-process the FDF, and break it into a separate FDF documents for each “page”.
We previously suggested AddSubView, which would allow you to add a View containing any content you like, that would float overtop of the viewer. This content would not zoom or scroll with the page.
It is not clear what exactly you want with regards to appearance and behaviour.
You want to overlay text, but does text need to scroll/zoom with the page?
Ryan, #1 You want to overlay text, but does text need to scroll/zoom with the page?
Yes.
#2 Why is having this text overlay important?
It is important from our requirement. we should apply the watermark text overlay the pdf document.
Note:We are already apply watermark the below code(html controls) over the document using webviewer.
me.docViewer.on(‘pageComplete’, function(e, pageIndex) {
}
I have attached screenshots for apply watermark over the xod document for your reference.
We need to apply watermark the following position details.
1.Header
2.Footer
3.Center
4.Header And Footer
5.Image
The easiest way to do this then, would be to use the Stamper class, and listen for the page downloaded events, and stamp each page once it is downloaded.
This has the downside of modifying the actual PDF file, though this might be what you want.
Alternatively, you could watermark on the server beforehand, so that file passed back to PDFViewCtrl.openUrl already has the watermarks.
The other alternative, is to modify the Tools project for each of iOS and Android. We have had a variety of customers do this, but it has to be done differently for iOS and Android. This would be more work than the two options above. If you want to do it this way, let me know which platform you want to start with (iOS or Android) and I can provide further instructions.