Hi ,
I have the following lines of code which I am trying to make it work .
Aspose.Pdf.Facades.PdfExtractor pdfExtractor = new Aspose.Pdf.Facades.PdfExtractor();
pdfExtractor.BindPdf(this.fupManualFileUpload.FileContent);
Document pdfDocument = new Document(pdfExtractor.Document.FileName.ToString());
I am unable to get the object pdfDocument from the pdfExtractor .
pdfExtractor is what i have got from the Aspose.Barcode
I even tried out pdfDocument = (Document)pdfExtractor.Document;
post this , I am getting error at the following line :
pdfDocument.Validate(“validation-result-A1A.xml”, PdfFormat.PDF_A_1A);
Hi Shilpi,
PdfExtractor pdfExtractor = new PdfExtractor();<o:p></o:p>
pdfExtractor.BindPdf(myDir + "savetoStream.pdf");
//extract all the images
pdfExtractor.ExtractImage();
int i=1;
//get all the extracted images
while (pdfExtractor.HasNextImage())
{
MemoryStream ms = new MemoryStream();
pdfExtractor.GetNextImage(ms);
Document doc = new Document();
Aspose.Pdf.Page page=doc.Pages.Add();
Aspose.Pdf.Image image = new Aspose.Pdf.Image();
image.ImageStream = ms;
page.Paragraphs.Add(image);
doc.Save(myDir+i+"image.pdf");
ms.Close();
i++;
}
Please feel free to contact us for any further assistance.
Best Regards,
Hi ,
My question is vice versa .
I have the pdfExtractor.Document object with me and I want to cast it pdfDocument object. I did this using following code:
Aspose.Pdf.Facades.PdfExtractor pdfExtractor = new Aspose.Pdf.Facades.PdfExtractor();
pdfExtractor.BindPdf(this.fupManualFileUpload.FileContent);
// set page range for image extraction
pdfExtractor.StartPage = 1;
// extract the images
pdfExtractor.ExtractImage();
Document pdfDocument = new Document();
pdfDocument = (Document)pdfExtractor.Document;
I am able to get the pdfDocument object but when i perdorm following validation :
if ((pdfDocument.Validate(“validation-result-A1A.xml”, PdfFormat.PDF_A_1A)) || (pdfDocument.Validate(“validation-result-A1A.xml”, PdfFormat.PDF_A_1B)) ||
(pdfDocument.Validate(“validation-result-A1A.xml”, PdfFormat.PDF_A_2A)) || (pdfDocument.Validate(“validation-result-A1A.xml”, PdfFormat.PDF_A_2B)) ||
(pdfDocument.Validate(“validation-result-A1A.xml”, PdfFormat.PDF_A_3A)) || (pdfDocument.Validate(“validation-result-A1A.xml”, PdfFormat.PDF_A_3B)))
{
flag=1;
}
I am gettign the folllowing error - Specified argument was out of the range of valid values.
Parameter name: offset
Hi Shilpi,
Hi,
Please provide me with the code sample … I am facing difficulty in integrating and achieving . I have a limitation that I cant get the value of pdfDocument like this,
Document pdfDocument = new Document(Server.MapPath(savePath1));
I have the value available in the pdfExtractor
pdfExtractor.BindPdf(this.fupManualFileUpload.FileContent);
Thanks,
Shilpi
Hi Shilpi,
PdfExtractor pdfExtractor = new PdfExtractor();<o:p></o:p>
int flag =0;
pdfExtractor.BindPdf(myDir + "input.pdf");
Document pdfDocument = pdfExtractor.Document;
if ((pdfDocument.Validate("validation-result-A1A.xml", PdfFormat.PDF_A_1A)) || (pdfDocument.Validate("validation-result-A1A.xml", PdfFormat.PDF_A_1B)) ||
(pdfDocument.Validate("validation-result-A1A.xml", PdfFormat.PDF_A_2A)) || (pdfDocument.Validate("validation-result-A1A.xml", PdfFormat.PDF_A_2B)) ||
(pdfDocument.Validate("validation-result-A1A.xml", PdfFormat.PDF_A_3A)) || (pdfDocument.Validate("validation-result-A1A.xml", PdfFormat.PDF_A_3B)))
{
flag = 1;
}
Console.WriteLine(flag);
We are sorry for the inconvenience caused.
Best Regards,