PDF Viewer and importing streams

Does syncfusions pdf tool have the ability to import a stream.

5 Replies

SA Saravanan A Syncfusion Team October 20, 2007 10:26 AM UTC

Hi Steve,

Yes. Essential PDF has the ability to import the data from stream object.

With version 5.1 and earlier you can use the following code to import/export a PDF from the stream object


//To import from stream
PDFDocument pdfDoc = new PDFDocument(streamObject);

//To export to stream
byte[] buffer=new byte[1105];
MemoryStream stream=new MemoryStream(buffer);
pdfDoc.Save(stream);


In version 5.2, we have completly changed the implementation of PDF. Currently it supports only to create and save the PDF and it don't have support to open an existing PDF files. However we will implement this support in our next release.
With this version also you can use the above mention code to save the PDF to memory stream.

Please let me know if you need more information.

Regards,
Saravanan


MA Mark December 3, 2007 09:53 PM UTC



OK, now we have the next release, are we able to open an existing PDF? I have had a quick look in the online documentation but don't see anything.



AD Administrator Syncfusion Team December 5, 2007 02:25 PM UTC

Hi Steve,

We regret to let you know that feature to open an existing PDF has not been implemented in v6.1. We will get back to you once this feature is implemented.

Please let me know if you have any concerns.

Thanks,
Melba



JW Jim Wilson January 11, 2008 09:10 PM UTC

The ability to open an existing PDF file is critical for me. The ONLY reason I purchased your component was to open files, stamp a license statement at the top of each page, set user and owner passwords, and then save the file. I just spent three hours upgrading to the latest version and then trying to figure out how to "fix" my code only to learn hear that what I need is no longer supported.

This seems like a huge step backwards. Am I missing something?



YG Yavanaarasi G Syncfusion Team April 30, 2008 09:44 AM UTC

Hi Jim,

Sorry for the delay in responding.

We can open the existing pdf in our latest version Essential Studio 2008 Volume 2. As per your requirements I have created one sample with open an existing Pdf and stamp a statement at the top of each page and set user and owner passwords. Please refer below code:


[C#]
PdfLoadedDocument lDoc = new PdfLoadedDocument(txtUrl.Text);
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 36f);
//Insert stamp
foreach (PdfPageBase lPage in lDoc.Pages)
{
PdfGraphics g = lPage.Graphics;
PdfGraphicsState state= g.Save();
g.SetTransparency(0.25f);
g.DrawString(txtStamp.Text, font, PdfPens.Red, PdfBrushes.Red, new PointF(10, 10));
}

//Security
PdfSecurity security = lDoc.Security;
security.KeySize = PdfEncryptionKeySize.Key128Bit;
security.OwnerPassword = "syncfusion";
security.Permissions = PdfPermissionsFlags.Print | PdfPermissionsFlags.FullQualityPrint;
security.UserPassword = "password";


Here is the sample:

http://websamples.syncfusion.com/samples/PDF.Windows/F-69069/main.htm

Please refer the documentation link below for how to open an existing document:

http://www2.syncfusion.com/ug_62/pdf/default.html

Please try this and let me know if this helps.

Regards,
G.Yavana




Loader.
Up arrow icon