Spire.PDFViewer is a powerful PDF Viewer component for .NET. It allows developers to load PDF document from stream, file and byte array.

Fri Sep 20, 2013 1:11 pm

Hi ,
I am using trial version of Spire.PdfViewer.
Below code is using for getting Attachments of PdfDocument. i am able to get attachment data but unable to get Attachment File Name. It is giving File Name always Blank.

if (pdfViewer.IsDocumentLoaded)
{
ListView lstView = new ListView();
lstView.View = View.Details;
lstView.Columns.Add("FileName", 200);
lstView.Columns.Add("Size", 120);

PdfDocumentAttachment[] attchments = pdfViewer.GetAttachments();
if (attchments != null && attchments.Length > 0)
{
for (int i = 0; i < attchments.Length; i++)
{
PdfDocumentAttachment attachment = attchments[i];
string fileName = attachment.FileName;
byte[] data = attachment.Data;
ListViewItem item = new ListViewItem();
item.Text = Path.GetFileName(fileName);
string size = (attachment.Data.Length / 1024).ToString() + "Kb";
item.SubItems.Add(size);
item.Tag = attachment;
lstView.Items.Add(item);
}
}

How to get the File Name of Attachments of pdfDocument using Spire.PdfViewer ?
Please Help.

kpradnya28@gmail.com
 
Posts: 7
Joined: Thu Sep 19, 2013 6:59 am

Mon Sep 23, 2013 2:45 am

Hi,
Sorry for late reply as weekend.
Thanks for your inquiry.
The issue has been reproduced, which has been transferred to our Dev team, once there are any progress from them, we will get it back to you ASAP. Sorry for inconvenience. Could you please provide us the document if convenience to help us do better test after we solve it.

If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Mon Sep 23, 2013 6:43 am

Hello ,
I have attached the pdf Document which has attachment. i want File Name of Attachment like 1]sharepoint_apps_with_lightswitch.pdf 2]Error.png using the code in .net.

Thanks and regards ,
pradnya

kpradnya28@gmail.com
 
Posts: 7
Joined: Thu Sep 19, 2013 6:59 am

Mon Sep 23, 2013 7:11 am

Hello,
Sorry that we don't get your pdf document, could you please send us it again? Kindly note that please zip it before uploading it or send it to our Email(support@e-iceblue.com).

If there are any questions, welcome to get it back to us.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Mon Sep 23, 2013 9:54 am

Hello ,

i have uploaded the pdf Document again. Kindly check.
Also i would like to mention that we can have any type of attachment file like .doc .pdf, .xls, .xlsx etc.

Thanks and regards,
pradnya

kpradnya28@gmail.com
 
Posts: 7
Joined: Thu Sep 19, 2013 6:59 am

Tue Sep 24, 2013 1:55 am

Hello,

Thanks for your information.
The issue has been resolved, now our Test team is testing, once it works fine, we will release a new hotfix and inform you.
If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Tue Sep 24, 2013 6:59 am

Hello ,
Thank you for your support.

How i can take "Spire.PdfViewer " control in my .net application to view the Pdfdocument ?


Thanks and Regards,
pradnya

kpradnya28@gmail.com
 
Posts: 7
Joined: Thu Sep 19, 2013 6:59 am

Tue Sep 24, 2013 8:23 am

Hello Pradnya,

Please follow the steps below.

1. Add a new tab called Spire.PdfViewer to Toolbox, please refer to PDFViewer1.jpg.
2. To choose Items for the tab, then you will see a dialog box (PDFViewer2.jpg), to browse and add Spire.PdfViewer.Forms.dll.
3. Now you can see "Spire.PdfViewer " control in Toolbox, just like PDFViewer3.jpg.

If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Tue Sep 24, 2013 9:45 am

Hello ,

Thank you for your great help !!!!!!!!!!!!!

Now i able to add the "Spire.PdfViewer" but unable to get the function like export image,Page Operations..

Does it Support Pdf Merging Functionality means can we merge two pdf Document together into single pdf Document .?

Also Does it support for Markup Functionality means can we copy only Markup (Clouds, Highlighted Text , Sticky Notes) from one pdf Document and apply these Markup to another pdf Document .

Thanks and Regards,
Pradnya

kpradnya28@gmail.com
 
Posts: 7
Joined: Thu Sep 19, 2013 6:59 am

Wed Sep 25, 2013 6:48 am

Hello Pradnya,
Sorry for the late reply.
Question:Now i able to add the "Spire.PdfViewer" but unable to get the function like export image,Page Operations.
Answer: Please refer to the following method to export image, and you could also get more demos about PdfViewer below Demo from http://www.e-iceblue.com/Introduce/pdf- ... #PDF2Image
Code: Select all
int currentPage=this.pdfDocumentViewer1.CurrentPageNumber;
Bitmap image=this.pdfDocumentViewer1.SaveAsImage(currentPage-1);
image.Save(fileName);

Question:Does it Support Pdf Merging Functionality means can we merge two pdf Document together into single pdf Document ?
Answer: Sorry that our PdfViewer product doesn't support it, but you could use our Spire.Pdf product to achieve it and refer to the following method.
Code: Select all
String[] files = new String[]
{
@"..\..\test.pdf",
@"..\..\test1.pdf"
};
//open pdf documents           
PdfDocument[] docs = new PdfDocument[files.Length];
for (int i = 0; i < files.Length; i++)
{
docs[i] = new PdfDocument(files[i]);
}
//import PDF pages
for (int i = 0; i < docs[1].Pages.Count; i = i + 2)
{
 docs[0].InsertPage(docs[1], i);
}
docs[0].SaveToFile(@"..\..\Result.pdf",FileFormat.PDF);

Question:Also Does it support for Markup Functionality means can we copy only Markup (Clouds, Highlighted Text , Sticky Notes) from one pdf Document and apply these Markup to another pdf Document .
Answer:
Sorry that our PdfViewer product doesn't support it, but you could use our Spire.Pdf product to achieve it and refer to the following method. But regarding Highlighted Text, sorry that at present we couldn’t get the text which is highlighted only get highlight as the Highlight Text Markup itself has no text property, which highlights the text that exists in pdf.
Code: Select all
PdfDocument pdfdoc = new PdfDocument();
pdfdoc.LoadFromFile(@"..\..\PDFviewer.pdf");
PdfDocument newpdf = new PdfDocument();
PdfPageBase newpage = newpdf.AppendPage();
foreach (PdfPageBase page in pdfdoc.Pages)
   {
   for (int i = 0; i < page.AnnotationsWidget.Count;i++ )
       {
          newpage.AnnotationsWidget.Add(page.AnnotationsWidget[i]);
        }
    }
newpdf.SaveToFile(@"..\..\result.pdf",FileFormat.PDF);
 


If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Wed Oct 02, 2013 3:10 am

Hello Pradnya ,
Have you tried the method? Does it fulfill your need? Could you please give us some feedback if convenience?
If any questions exist, please tell us.

Regards,
Benjamin
E-iceblue support team
User avatar

Benjamin Du
 
Posts: 82
Joined: Thu Jul 25, 2013 2:38 am

Fri Oct 25, 2013 8:16 am

Hello,

I am using below code to remove attachment from pdf file. for some pdf documents it is working fine but for some documents it is giving error.

error :- "Unexpected token DictionaryEnd before 195"

Code :-

Dim doc As New Spire.Pdf.PdfDocument()
doc.LoadFromFile("C:\PdfFiles\Test.pdf")
Dim attachments As PdfAttachmentCollection = doc.Attachments // Error at this line while executing the code.
If attachments.Count > 0 Then
doc.Attachments.Clear()
End If

doc.SaveToFile("C:\Users\pradnyak\Desktop\Pdf Files\output.pdf")


Please help.

Thanks and regards,
pradnya

kpradnya28@gmail.com
 
Posts: 7
Joined: Thu Sep 19, 2013 6:59 am

Fri Oct 25, 2013 9:26 am

Hello,

Thanks for your feedback.
Could you please provide us the pdf document you test if convenience? It would be helpful for us to reproduce the issue you experienced, kindly note that please zip it before uploading or send it to our Email(support@e-iceblue.com).

Thanks in advance,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Fri Oct 25, 2013 2:46 pm

Hello,

I am using below code to remove attachment from pdf file. for some pdf documents it is working fine but for some documents it is giving error.

error :- "Unexpected token DictionaryEnd before 195"

Code :-

Dim doc As New Spire.Pdf.PdfDocument()
doc.LoadFromFile("C:\PdfFiles\Test.pdf")
Dim attachments As PdfAttachmentCollection = doc.Attachments // Error at this line while executing the code.
If attachments.Count > 0 Then
doc.Attachments.Clear()
End If

doc.SaveToFile("C:\Users\pradnyak\Desktop\Pdf Files\output.pdf")

Please do not share the pdf attached. please keep it private.
Please help.

Thanks and regards,
pradnya

kpradnya28@gmail.com
 
Posts: 7
Joined: Thu Sep 19, 2013 6:59 am

Mon Oct 28, 2013 2:32 am

Hello Pradnya,

Sorry for late reply as weekend.

Thanks for your information. We have reproduced the issue, which has been transferred to our Dev team, once there are any progress from them, we will get it back to you immediately. Sorry for inconvenience.

If there are any questions, welcome to get it back to us.

Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Return to Spire.PDFViewer