We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Issues with extracting or replacing images

Thread ID:

Created:

Updated:

Platform:

Replies:

144985 May 14,2019 12:32 PM UTC May 31,2019 09:57 AM UTC ASP.NET Core - EJ 2 7
loading
Tags: DocIO
Sriparthu
Asked On May 14, 2019 12:32 PM UTC

How to retrieve the coordinates of a textbox (inserted in word doc before conversion) which has text in a PDF - which got converted from Word doc - Using Syncfusion.pdf.net.core dll ?(Attached)

 

2. In pdf doc When replace function is used to replace an image based on index, it is replacing other images of same size, how to achieve this? How do I uniquely identify images in pdf doc?(Attached)this I tried with .net framework 4.7?

 

·         Below code is not working while I am trying to replace single image in doc, it is replacing all related images in the pdf doc.

 

 

 

 

 

 

 

3. Coredll - not having replace function?

 

 

 

 

·         Core dll is not supporting the image related information as highlighted above while working with images in the PDF Doc.

 

4. How to add multiple digital signatures?

 

 

  1. //Load the PDF document
  2. FileStream docStream = new FileStream("SignatureFields.pdf", FileMode.Open, FileAccess.Read);
  3. PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
  4. //Gets the first page of the document
  5. PdfLoadedPage page = loadedDocument.Pages[0] as PdfLoadedPage;
  6. //Gets the first signature field of the PDF document
  7. PdfLoadedSignatureField signatureField1 = loadedDocument.Form.Fields[0] as PdfLoadedSignatureField;

 

·         We are getting null value at signaturefield1 due to present of two forms in the collection and first field is not containing any value.

 


Attachment: Issues_Description_935d23ac.zip

madhubabup
Replied On May 15, 2019 06:07 AM UTC

Hi team,

Please resolve the below mentioned issues asap.

Regards,
Madhu

Sowmiya Loganathan [Syncfusion]
Replied On May 15, 2019 05:03 PM UTC

Hi Sripathu, 

Greetings from Syncfusion. 

How to retrieve the coordinates of a textbox (inserted in word doc before conversion) which has text in a PDF - which got converted from Word doc - Using Syncfusion.pdf.net.core dll ?(Attached 
We can retrieve the coordinates of textbox field in a PDF document. Please refer the below code snippet, 


//Get the loaded form  
PdfLoadedForm loadedForm = loadedDocument.Form; 
 
//Get the loaded form field 
PdfLoadedTextBoxField textBoxField = loadedForm.Fields[0] as PdfLoadedTextBoxField; 
 
//Get the bounds 
RectangleF bounds = textBoxField.Bounds; 


While converting Word to PDF document, we need to enable “PreserveFormFields” property to preserve the Word document form field as editable PDF form field in PDF document. Please refer the below UG documentation for more details, 
In pdf doc When replace function is used to replace an image based on index, it is replacing other images of same size, how to achieve this?  

We can replace an image based on index with the same size on other image. Please refer the below UG documentation for more details, 

How do I uniquely identify images in pdf doc?(Attached)this I tried with .net framework 4.7?  
We can identify the images in PDF document based on its index.  
I am trying to replace single image in doc, it is replacing all related images in the pdf doc. 
While adding same images in multiple times in a PDF document, it will add only single resource and shared it for all. So, when replacing the image it will replace all and this is the default behavior. 
. Coredll - not having replace function?  Core dll is not supporting the image related information as highlighted above while working with images in the PDF Doc.   
At present we do not have support for “Replacing images in an existing PDF document” and “Get image related information” in .NET Core.  
How to add multiple signature?  
Please refer the below code snippet to add multiple signature, 

PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream); 
 
//Gets the first page of the document. 
PdfLoadedPage page = loadedDocument.Pages[0] as PdfLoadedPage; 
 
//Load the form  
PdfLoadedForm loadedForm = loadedDocument.Form as PdfLoadedForm; 
 
//Gets the first signature field of the PDF document. 
PdfLoadedSignatureField field = loadedForm.Fields[0] as PdfLoadedSignatureField; 
 
//Creates a certificate 
FileStream certificateStream = new FileStream("PDF.pfx", FileMode.Open, FileAccess.Read); 
PdfCertificate certificate = new PdfCertificate(certificateStream, "syncfusion"); 
 
//Add signature to field 
field.Signature = new PdfSignature(loadedDocument, page, certificate, "Signature", field); 
 
//Save and closes the document to stream  
MemoryStream stream = new MemoryStream(); 
loadedDocument.Save(stream); 
loadedDocument.Close(true); 
 
//Load the document  
PdfLoadedDocument loadedDocument1 = new PdfLoadedDocument(stream); 
 
//Add signature to second signature field  
PdfLoadedSignatureField signatureField1 = loadedDocument1.Form.Fields[1] as PdfLoadedSignatureField; 
signatureField1.Signature = new PdfSignature(loadedDocument1, loadedDocument1.Pages[0] as PdfLoadedPage, certificate, "Sig", signatureField1); 

loadedDocument1.Save(ms); 


We are getting null value at signaturefield1 due to present of two forms in the collection and first field is not containing any value.  
As per the provided code snippet, we suspect that the issue may occurs due to get field from new collection. Kindly use the below code snippet to get the collections of form fields in a PDF document.  


//Load the form  
PdfLoadedForm loadedForm = loadedDocument.Form as PdfLoadedForm; 
 
//Gets the first signature field of the PDF document. 
PdfLoadedSignatureField field = loadedForm.Fields[0] as PdfLoadedSignatureField; 



Regards, 
Sowmiya L 


madhubabup
Replied On May 27, 2019 10:45 AM UTC

Hi Team,

. Coredll - not having replace function? Core dll is not supporting the image related information as highlighted above while working with images in the PDF Doc.   
At present we do not have support for “Replacing images in an existing PDF document” and “Get image related information” in .NET Core.  

1.When can we get this fix into the core dll related to “Replacing images in an existing PDF document” and “Get image related information”?
2. We need to identify a place holder to insert a digital signature in pdf doc, can you suggest best approach in order to achive the required action to replace place holder other than image in core.?


How do I uniquely identify images in pdf doc?(Attached)this I tried with .net framework 4.7?  
We can identify the images in PDF document based on its index.  
3.In this scenario i had three different images ,based on index i cant identify which image is related to which one.please suggest a way to identify the image?



madhubabup
Replied On May 28, 2019 06:28 AM UTC

Hi team,

How to retrieve the coordinates of a textbox (inserted in word doc before conversion) which has text in a PDF - which got converted from Word doc - Using Syncfusion.pdf.net.core dll ?(Attached 
We can retrieve the coordinates of textbox field in a PDF document. Please refer the below code snippet, 


//Get the loaded form  
PdfLoadedForm loadedForm = loadedDocument.Form; 
 
//Get the loaded form field 
PdfLoadedTextBoxField textBoxField = loadedForm.Fields[0] as PdfLoadedTextBoxField; 
 
//Get the bounds 
RectangleF bounds = textBoxField.Bounds; 


While converting Word to PDF document, we need to enable “PreserveFormFields” property to preserve the Word document form field as editable PDF form field in PDF document. Please refer the below UG documentation for more details, 
 As per you suggestion tried to preserve the form fields in word doc during word to pdf conversion ,below are the issues i am facing while converting word to pdf as epr your suggestion.

  • using Syncfusion.DocIO
  • using Syncfusion.DocIO.DLS
  • using Syncfusion.DocIORenderer
  • using Syncfusion.Pdf

When i installed  below mentioned two packages as per the portal link :
Install-Package Syncfusion.DocIO.Net.Core
Install-Package Syncfusion.DocIORenderer.Net.Core

// Install dependent package
Install-Package SkiaSharp -Version 1.59.3
i am getting below error while i am trying to convert word doc to pdf.






While i am trying to work by installing below dlls and convert the word to doc in core i am getting below error.

Install-Package Syncfusion.DocIO.AspNet
Install-Package Syncfusion.DocToPdfConverter.AspNet
Install-Package Syncfusion.OfficeChartToImageConverter.AspNet
Please find the screen shot for reference.



Regards,
Madhu

Sowmiya Loganathan [Syncfusion]
Replied On May 28, 2019 11:07 AM UTC

Hi Madhu, 

As per you suggestion tried to preserve the form fields in word doc during word to pdf conversion ,below are the issues i am facing while converting word to pdf as per your suggestion. 
  • using Syncfusion.DocIO
  • using Syncfusion.DocIO.DLS
  • using Syncfusion.DocIORenderer
  • using Syncfusion.Pdf
 
When i installed  below mentioned two packages as per the portal link : 
Install-Package Syncfusion.DocIO.Net.CoreInstall-Package Syncfusion.DocIORenderer.Net.Core// Install dependent packageInstall-Package SkiaSharp -Version 1.59.3
i am getting error while i am trying to convert word doc to pdf. 
 
We suspect that you have installed both Base (Assemblies / NuGet used for WPF, WF and ASP.NET web applications) and Portable (Assemblies / NuGet used for ASP.NET Core and Xamarin application) in your current application.

Please use the assemblies depends on the platform of the application. For more details about the assemblies usage, please use the below UG documentation page.

https://help.syncfusion.com/file-formats/docio/assemblies-required  
While i am trying to work by installing below dlls and convert the word to doc in core i am getting below error. 
 
Install-Package Syncfusion.DocIO.AspNet 
Install-Package Syncfusion.DocToPdfConverter.AspNet 
Install-Package Syncfusion.OfficeChartToImageConverter.AspNet 
 
As mentioned above, please use the “Portable” NuGet alone in the ASP.NET Core application. You have tried to install the “Base” assemblies in the .NET Core application. These base assemblies are entirely depended only for WPF, WF and ASP.NET Web application alone.

Please install the proper NuGet depends upon the platform to avoid this kind of conflicts.
 
 
We suggest you make use of our UG documentation page using the below link to know more details about NuGet and assemblies depends required for each platform.

https://help.syncfusion.com/file-formats/docio/nuget-packages-required

https://help.syncfusion.com/file-formats/docio/assemblies-required
 
 
Note: If you are facing the same issue means, then we would, therefore, like to set up a web meeting with you to check and provide resolution. Could you please let me know of your availability for this? Our team will make every effort to have this scheduled on a date and time per your convenience

 
When can we get this fix into the core dll related to “Replacing images in an existing PDF document” and “Get image related information”? 
At present, we do not support extract/replacing images in an existing PDF document and get image information in the .NET Core framework. However, we have added it to our features request list and it can be tracked through our features management system. 
 
 
We do not have any immediate plans to implement this feature and this feature will be included in any of our upcoming release. Please let us know if you have any concerns on this. 
We need to identify a place holder to insert a digital signature in pdf doc, can you suggest best approach in order to achieve the required action to replace place holder other than image in core.? 
We have created the sample to achieve your requirement. Please refer the sample for the same from below link, 
 
 
Please try with this sample and let us know whether it satisfies your requirement. If not please provide us further details on this. 
.In this scenario i had three different images ,based on index i cant identify which image is related to which one.please suggest a way to identify the image? 
We can get the image position based on its preservation in the PDF page. Please refer the below code snippet for more details, 
 
PdfImageInfo[] imageInfos = page.ImagesInfo; 
 
foreach(var info in imageInfos) 
{ 
    int index = info.Index; 
    RectangleF bounds = info.Bounds; 
} 
 
In some cases the image position has been changed. In that case we can identify the image based on the bounds as mentioned in the above code snippet. Please let us know whether it satisfies your requirement. 
 
Regards, 
Sowmiya L 



madhubabup
Replied On May 30, 2019 07:20 AM UTC

hi Sowmiya L 

How to retrieve the coordinates of a textbox (inserted in word doc before conversion) which has text in a PDF - which got converted from Word doc - Using Syncfusion.pdf.net.core dll ?(Attached 
We can retrieve the coordinates of textbox field in a PDF document. Please refer the below code snippet, 


//Get the loaded form  
PdfLoadedForm loadedForm = loadedDocument.Form; 
 
//Get the loaded form field 
PdfLoadedTextBoxField textBoxField = loadedForm.Fields[0] as PdfLoadedTextBoxField; 
 
//Get the bounds 
RectangleF bounds = textBoxField.Bounds; 


While converting Word to PDF document, we need to enable “PreserveFormFields” property to preserve the Word document form field as editable PDF form field in PDF document. Please refer the below UG documentation for more details, 

I tried with above solution and i am unable to carry forward the form fields in word doc to PDF as editable.Providing you the sample word doc.tried in .net 4.7 frame work.


While i am trying to work by installing below dlls and convert the word to doc in core i am getting below error. 
 
Install-Package Syncfusion.DocIO.AspNet 
Install-Package Syncfusion.DocToPdfConverter.AspNet 
Install-Package Syncfusion.OfficeChartToImageConverter.AspNet 
 
As mentioned above, please use the “Portable” NuGet alone in the ASP.NET Core application. You have tried to install the “Base” assemblies in the .NET Core application. These base assemblies are entirely depended only for WPF, WF and ASP.NET Web application alone. 

Please install the proper NuGet depends upon the platform to avoid this kind of conflicts.
 
 
We suggest you make use of our UG documentation page using the below link to know more details about NuGet and assemblies depends required for each platform.

https://help.syncfusion.com/file-formats/docio/nuget-packages-required 

https://help.syncfusion.com/file-formats/docio/assemblies-required
 
 
Note: If you are facing the same issue means, then we would, therefore, like to set up a web meeting with you to check and provide resolution. Could you please let me know of your availability for this? Our team will make every effort to have this scheduled on a date and time per your convenience

On friday we are available, can we have call at friday in the second half.


Regards,
Madhu



Attachment: H111001_sample_a202962f.zip

Vijayasurya Anandhan [Syncfusion]
Replied On May 31, 2019 09:57 AM UTC

Hi Madhu,

Please find the details for your queries below as follows:


 
Query 
Detail 
I tried with the above solution and I am unable to carry forward the form fields in word doc to PDF as editable. Providing you the sample word doc.tried in .net 4.7 frame work. 
 
On further analyzing the input Word document provided form your side, we could not find any form fields in the document provided from your side.

We request you to share the screenshot of the form field in which you have been facing an issue which will be helpful for us to track the issue and provide you solution at earliest.
 
Regarding meeting request to discuss NuGet conflict  
A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates  
 



Regards,
 
Vijayasuya A

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon