- Remove From My Forums
-
Question
-
Hi
I am using C# code to convert to word to pdf. We created exe out of C# coade and using in our java program. The pdf is creating successfully but the problem is it is not searchable. It is creating as bitmap instead of text. I need your help here. I am pasting
my code below. Your help is appreciated. Thanks . Sridharusing System;
using System.Collections.Generic;
using System.Collections;
using System.Diagnostics;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using Word = Microsoft.Office.Interop.Word;
using System.IO;
using Microsoft.Office.Interop.Word;
namespace DocToPdfConverter
{public class DocToPdfConverter
{static int Main(string[] args)
{
String inputFileName = args[0];
String outputFileName = args[1];
Console.WriteLine(«Started Converting Word Document To Pdf >> …..»);
DocToPdfConverter dc = new DocToPdfConverter();
Microsoft.Office.Interop.Word.Application application = newMicrosoft.Office.Interop.Word.Application();
dc.ConvertToPdf(inputFileName, outputFileName, application);
Console.WriteLine(«Successfully Done With PDF Conversion.»);
return 0;
}public void ConvertToPdf(String inputFileName, String outputFileName, Microsoft.Office.Interop.Word.Application
application)
{
object originalFormat = null;
object routeDocument = false;
object saveOption = null;
Word.Bookmarks bookmarks = null;
string bookmarkNames = string.Empty;
String outName = string.Empty;
try
{
object missing = System.Reflection.Missing.Value;
object readOnly = false;
object isVisible = true;
object inputsFileName = inputFileName;
application.Visible = true;
application.DefaultWebOptions().AlwaysSaveInDefaultEncoding = true;
Word.Document aDoc = application.Documents.Open(ref inputsFileName, ref missing,
ref readOnly, ref missing, ref missing,
ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref isVisible);
saveOption = Word.WdSaveOptions.wdDoNotSaveChanges;
originalFormat = Word.WdOriginalFormat.wdOriginalDocumentFormat;
object fileFormat = WdSaveFormat.wdFormatPDF;
object outputFileNames = outputFileName;if (aDoc != null)
{
Console.WriteLine(«Before Export…….»);
aDoc.ExportAsFixedFormat( outputFileName, WdExportFormat.wdExportFormatPDF, false,
WdExportOptimizeFor.wdExportOptimizeForPrint,
WdExportRange.wdExportAllDocument, 0, 0,
WdExportItem.wdExportDocumentContent, true, true,
WdExportCreateBookmarks.wdExportCreateHeadingBookmarks,
true,true, false, ref
missing);
Console.WriteLine(«After Export…………..»);
}}
catch (Exception e)
{
Console.WriteLine(e);
}
finally
{
application.Quit(ref saveOption, ref originalFormat, ref routeDocument);
}}
}
}-
Edited by
Tuesday, September 1, 2015 11:55 AM
-
Moved by
CoolDadTx
Tuesday, September 1, 2015 7:29 PM
Office related
-
Edited by
Answers
-
Hi Sridhar,
>>The pdf is creating successfully but the problem is it is not searchable. It is creating as bitmap instead of text.<<
The issue is not relative to the code generate the PDF file, the PDF is generated correctly by Word application. It depends on the tools/library you used to open the PDF.
You also could use Word 2013 to open, manipulate it.
Hope it is helpful.
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.-
Proposed as answer by
Fei XueMicrosoft employee
Friday, September 4, 2015 7:14 AM -
Marked as answer by
Fei XueMicrosoft employee
Thursday, September 10, 2015 6:06 AM
-
Proposed as answer by
I want to generate pdf from MS Word, but the pdf format should be somehow like a scanned document (i.e., pdf as image, and all text is not searchable).
At the moment, I have 2 solutions:
-
print out the Word Document and scan back to computer as pdf (but it is a kind of wasting paper)
-
install some pdf printer tools that is available on internet (but I do not have the admin right for installation)
Therefore, is there any other way to do this?
Thanks!
asked Aug 25, 2019 at 4:45
1
Use an online converter such as https://www.zamzar.com to convert your document to multipage tiff. That should get rid of any text and leave you with a file that just contains images.
Then either print that to .pdf if you have the appropriate printer driver on your operating system, or use the same or another service to convert the .tif to a .pdf.
answered Aug 25, 2019 at 20:04
This PDF converter is your go-to solution to convert Word to PDF online. Convert Microsoft Word documents to the popular and practical Adobe PDF format. Convert DOC to PDF or DOCX to PDF.
Convert Word to PDF Online
for free and wherever you want
Using PDF2Go to convert your Word document to PDF is fast, easy and instant. All you need is a stable internet connection and your file.
Upload your Word document via drag and drop, browsing, a cloud storage or by giving a link. Then, all you need to do is to click on “Save Changes” and wait until we converted your file for you.
Afterwards, you can download, save or further edit your PDF.
Installing a program on your computer comes with risks. Malware and viruses just wait for an opening. While mobile apps seem safer, they often come with annoying advertisements or suspicious access to your phone.
That’s why PDF2Go lets you convert online! No viruses, no installations. All you need is an internet connection.
The PDF document format comes with many advantages. It retains formatting and thus looks the same when you print or share it with others. It’s highly compatible and there are readers available for all computer systems, phones and even e-book readers.
Use these and many more advantages by using a trusty PDF converter like PDF2Go.
Uploading your Word document to convert to PDF has never been safer. We make sure that your file is safe every step of the way. Plus, we do not obtain any right on your file, it stays yours and yours only.
More information can be found in our Privacy Policy.
We are specialized to convert Word to PDF. But this is not our limit! Next to DOC and DOCX, you can convert other text documents, presentations and even images!
For example:
ODT, RTF, TXT, Microsoft PowerPoint PPT, JPG, PNG, GIF and more
You are not bound to your computer! PDF2Go is an online PDF converter. This means you can use the service from any computer, at work or at home, and even on holidays!
PDF2Go works on tablets and smartphones as well!
Rate this tool
4.7 / 5
You need to convert and download at least 1 file to provide feedback
Feedback sent
Thank you for your vote
Sejda
All Tools
Compress
Edit
Fill & Sign
Merge
Delete Pages
Crop
Pricing
Desktop
Log in
Creates a PDF document from Microsoft Word .docx
Upload PDF files
- Dropbox
- Google Drive
- OneDrive
- Web Address (URL)
Files stay private. Automatically deleted after 2 hours.
Free service for documents up to 200 pages or 50 Mb and 3 tasks per hour.
Terms of Use and Privacy Policy
Offline Rather work offline? Try Sejda Desktop
Contact Support
Сконвертируйте ваши doc-файлы в pdf онлайн и бесплатно
Перетащите файлы сюда. 100 MB максимальный размер файла или Регистрация
Конвертировать в DOC
doc
Документ Microsoft Word
DOC ― это расширение файлов для документов текстового редактора. Оно связано преимущественно с приложением Microsoft Word. Файлы DOC также могут содержать графики, таблицы, видео, изображения, звуки и диаграммы. Этот формат поддерживается почти всеми операционными системами.
Конвертер PDF
Портативный формат документов
PDF ― это формат электронных документов, разработанный Adobe Systems с использованием некоторых функций языка PostScript. Официальная программа для просмотра документов в этом формате ― это Adobe Reader. Чаще всего PDF-файл представляет собой сочетание текста с растровой и векторной графикой, текстовыми формами, скриптами, написанными на JavaScript, а также иными элементами.
Как сконвертировать DOC в PDF
Шаг 1
Загрузите doc-файл(ы)
Выберите файлы с компьютера, Google Диска, Dropbox, по ссылке или перетащив их на страницу.
Шаг 2
Выберите «в pdf»
Выберите pdf или любой другой формат, который вам нужен (более 200 поддерживаемых форматов)
Шаг 3
Загрузите ваш pdf-файл
Позвольте файлу сконвертироваться и вы сразу сможете скачать ваш pdf-файл
Рейтинг DOC в PDF
4.8 (96,441 голосов)
Вам необходимо сконвертировать и скачать любой файл, чтобы оценить конвертацию!