Preselect Filename when printing to PDF - c#

Can anyone recommend a tool that will allow me to set a registry key or a INI file, or something that will preselect the filename of a PDF when I print it?
I have written code to render some HTML in a web browser control, I simply want to export that HTML file to a PDF as easily as possible. Its been awhile since I have done this but I thought some of the free PDF printers had a registry key or an INI file I can insert a file name and that would make the SAVE dialog not appear and simply print the next file to that file name.

Win2PDF has a registry API to print to PDF while bypassing the save dialog. It also has an auto-name feature that will automatically name the PDF based on the document title, the current date, and the current time.

Related

File download links in a textbox in ASP.Net C#

I have a list of PDF files retrieved from an Azure storage location.
Currently, in my Web App, I filter and gather all of the PDF file names that the user may want and display them in a <asp:TextBox> by assigning a string (e.g. "PDF1.pdf\r\nPDF2.pdf\r\nPDF3.pdf") to the Text property of the TextBox. So they appear like this:
PDF1.pdf
PDF2.pdf
PDF3.pdf
I know the location of the files - e.g. "https://mypdfs.blob.core.windows.net/pdf-repository/" - so can prepend that info to each file for the link (but still would like to only show the filename itself to the user).
I would like the users to be able to click on any of the PDF filenames and have the file download and appear in their local PDF reader. However, I'm not seeing how to do this in a TextBox.
Can this be done within a TextBox? If not, what are the normal methods of doing something like this?

How can I open in the Adobe Reader application("AcroRd32.exe"), a PDF online with url?

So my problem is I'm trying to open a PDF file to sign the document, but the document only exists online. To sign the PDF I would like to click in a Button and it would open the PDF that i want, but in the Adobe Reader application. So that the user could do whatever he wants in the PDF.
Need some help on the part of open a pdf that only exists online, but in the application od the adobe Reader.
Thanks any help!!
EDIT1:
So the problem is that my boss do not want the PDF to be download. He wants to click the button and open in the Adobe Reader Application...
In order to open the file from AdobeReader locally, you are going to have to copy at minimum a temp file locally. Otherwise, you would have to either create or use a web application that is capable of accessing these files. Either way whatever is accessing the PDF is going to need a copy to display whether it's on your local machine or on a server somewhere.
Any PDF that exists online can be downloaded. Once downloaded, you can open it in any PDF reader like AdobeReader. Are you sure you are not able to download it?

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.

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.

Edit Saved Microsoft Word Document in C#/Asp.net

I am not sure if this is possible and every where I have searched, I cannot find a clear answer. I am saving a Microsoft Word document to a SQL Server 2008 table. Basically just converting the file to a Byte[] and writing that to the table. This word document is a "template" file. The file is a form that the user needs to fill out. What I am wondering, is after reading that file from SQL Server and before opening it up for the user, is there a way to autopopulate some fields in the form for the user? For example, if I know the address of the user already, can I autopopulate the address field in the template for them?
I know that using Microsoft.Office.Interop.Word, I can search the document for bookmarks and insert data at the bookmark. However, as far as I know, you cannot use Microsoft.Office.Interop.Word to open a Byte[].
Is there anyway to complete what I was looking for?
If you want to use OpenXML, then you can do it like this,
//Load your byte[] array into memory stream and then
WordprocessingDocument doc = WordprocessingDocument.Open(stream, true);
You can do what you are trying to achieve using OpenXML without installing word on the server side..More resources on OpenXMl can be found on http://openxmldeveloper.org/. And the open xml sdk can be downloaded from here.
I think the general steps would be to
1) Save the file to the local hard drive of the user with a file name based on the template but with a .doc extension.
2)Open the file with interop, but keep it invisible.
3)Populate the fields with bookmarks.
4)Show it to the user.

Categories