Xamarin forms - load dynamic s3 url

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.

Waiting for you reply
Thanks

It’s possible to load xod file?

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.

Ryan,Thank you for your kind response.

From xod webviewer
var xfdfString = this.docViewer.getAnnotationManager().exportAnnotations();

Xamarin code
mPdfViewCtrl.OpenUrlAsync(item.Url, “”,"");

How to load annotation string(xfdfString from xod) into xamarin forms?

Thanks

Ryan,
How to apply the watermark when a user requests the file(dynamic watermark) using xamarin forms?

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.

Thanks

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.

mPdfViewCtrl.docLock(true); mPdfViewCtrl.getDoc().fdfMerge(fdfdoc); mPdfViewCtrl.docUnlock(); mPdfViewCtrl.update(true);

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.

  1. we have used PDFViewCtrl.DocumentDownloaded event,But i got error on mPdfViewCtrl.getDoc().fdfMerge(fdfdoc) in andoid.
    i have sample code for your refrence.

_mPdfViewCtrl.DocumentDownloaded += (s, d) =>
{
if (d.PageCount == d.PageDownloaded)
{
_mPdfViewCtrl.DocLock(true);
_mPdfViewCtrl.getDoc().fdfMerge(fdfdoc);
_mPdfViewCtrl.DocUnlock();
_mPdfViewCtrl.Update(true);
}
};

Note: Using dll for PDFNetXamarin.Android-6.7.1.20170406.

Thanks

I need a bit more time for question #1.

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”.

Hi Ryan,

Have you any update for question #1.

Thanks

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?

Why is having this text overlay important?

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

waiting for your response.

Thanks

01_WaterMark_Postion_details.png

02_Header_Watermark.png

03_Bottom_Watermark.png

04_Center_Watermark.png

05_Both_Header_And_Footer.png

Image_watermark.png

Thank you for the clarifications.

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.