How to keep pdf structure after add/replace image by Aspose.Pdf - c#

I trying to replace images in a pdf page with another image outside using Aspose.Pdf. This is the pdf before replace that's opened by AI:
And this is the pdf after replace:
How can I keep the structure of pdf when I do replacement?
Thanks.

The issue seems to be due to the evaluation version you are using. The evaluation watermark is added to the PDF file and that is causing the structure to change. I would suggest you to request a temporary license file using this link. Try with the temporary license and check the structure of the generated file.
P.S. I am working as Social Media Developer at Aspose.

Related

Report in .rdlc format exported to PDF as read only C#

I'm working in an app in .NET where i'm using a report (.rdlc format) that i export to PDF. My client needs the PDF to be read only for security purposes. I already tried with FileAttributes and FileInfo libraries.
My biggest problem is that when i see my PDF properties, the checkbox for read-only is ticked but then i try to edit the fields with Adobe Acrobat and i am able to do it.
Any ideas?
I think you need create PDF/A files. It is separate archive standard of PDF (not "readonly" property). So when you open PDF/A files you get notification that it is archive file. End-user could edit any file, but in such case "archive" property will lost.
Unfortunately SSRS could not make PDF/A files.
May be, you should look for another report generator. Something like Crystal or FastReport. I checked FR and ensured that it can create PDF/A.
This can be done by importing iTextSharp library and using the following code:
I couldn't solve my problem without rendering and saving the PDF first in the file system as a dummy file, i.e., with all permissions. As you can see in the code, afterwards, i refer to the same dummy file and change it's permissions with static method Encrypt() from the iTextSharp library. Then, i save my finished and restricted PDF to the file system and delete the dummy one.

Download contents of html text area tag as word or pdf file in c#

I am working on a ASP .NET project where the requirement is to download a text area content as a file like .doc, .pdf and .txt.
I know we can download the plain text of text area as .txt using java script but the thing I want to know is,
How can I achieve the same for .doc and .pdf
is there any java script/jquery way to achieve this if not then what is the right way to do this in native C#.
examples or links would be great.
PDF and Word Documents are complex file types. If you want to generate these files client side, you'll need a javascript library that can generate files in these formats. I don't think these exist (as this is an uncommon request), but you can google it.
If I would be faced with a problem like this, I would post the value of the textbox back to the server and generate the files on the server. This SO post discusses how to create a pdf file in C#: How to generate a PDF?
Once you have created the file server side, you can then send it back to the client.

Can i retrieve images and shapes from word file and display them in PictureBox control of C#?

I want to extract images and shapes from word file and display them in picturebox control of C#.Is it possible? and if its then how ? i am searching it for many days but didn't find any solution. So plz help me
If you're working with MS Word documents in Open Office XML format (e.g. .docx files) you could try reading them out of the file directly. The .docx file is just a zip file and the images are contained in a media directory inside them. This page has more information on the file format.1
Alternatively I guess you could try automating Word using COM, to open the file and then retrieve the image that way. This approach has the disadvantage of spawning an instance of Word.
Either method will involve more detailed steps than I've described here, but should be do-able.
You can actually do it without going in to the trouble of using OpenXML or word interop libs.
This is what you need to do.
Rename your MyDoc.docx file with MyDoc.zip.
Then unzip the contents. You will get a very specific folder structure.
Ex: _rels, docProps,word, [Content_Types].xml
Go into word folder
Inside the word folder you will see a folder called media. That's where your images are.
Now you should be able to read and load these images in to picture boxes.

How to extract a PDF from an SWF player on a web page?

There is a book on this page (http://img.docin.com/players/DocinViewer.swf?productId=463932528), and it is inside a swf player. Previously there was a software which can extract all pages in the swf player and store them as a pdf file.
So there should be 3 steps:
Find the file source inside the swf player
Extract all pages from the swf player.
Save them as a whole pdf file.
How might one accomplish this?
I don't know the exact answer, but perhaps someone can expand. It seems to me that using these two references, you could search for the PDF in the stream you get back in the SWF to identify the SWF header, and structure, and the PDF header and footer and then reconstitute the PDF directly from the stream:
http://www.adobe.com/content/dam/Adobe/en/devnet/swf/pdf/swf_file_format_spec_v10.pdf
Structure of a PDF file?
Alternatively maybe an existing tool will do the trick:
http://download.cnet.com/SWF-Printer-Pro/3000-10743_4-10740922.html
Or update the open source project below, mentioned by a commenter to the level you need, using the references for the newer SWF and PDF formats:
http://sourceforge.net/projects/swfdotnet/

How HTML to PDF works (specially abcPDF)

My new project is converting the HTML into PDF on the fly using the URL.
I have searched a lot in my initial period and come up with the solution so that HTML convert to IMAGE and IMAGE goes to PDF.
But its not ideal solution as user can not copy paste from the PDF file.
Recently i came across abcPDF component, you can check their demo here http://www.abcpdfeditor.com/
Now i am wondering how they are able to produce such a nice PDF with all such feature. What will be their logic? I dont think they are going to parse each and every HTML tag to create document. Do you guys have any idea?
Any help will be much appreciated
In short, this is how most HTML to PDF conversion works.
HTML ----Converted To ----> EMF (Metafile/Vector Image) ----> PDF
Basically, IE's rendering engine (i.e, MSHTML) has some APIs through which you can export loaded HTML page as Emf (Enhanced metafile format) which is nothing but a vector image.
You can make use of this open-source web browser control for this purpose.
http://groups.google.com/group/csexwb
Then you have to render the generated EMF file on to PDF page. This is typically called as, EMF to PDF conversion. Based on my understanding there is no free Emf to PDF conversion software available. But ITextsharp provides minimal support for WMF format.

Categories