Setting Font for converting multiple text files into PDF using VB 6.0
Dear All,
Am converting multiple text files into PDF using VB6.0. Currently, am unable to control the font face and size for the generated files. Below is the procedure am using for each file;
Public Sub proc_convert_to_PDF(srcFilename As String, destFilename As String)
Dim p_AcroApp As CAcroApp
Dim p_VDoc As CAcroAVDoc
Dim p_DDoc As CAcroPDDoc
Dim IsOk As Boolean
Set p_AcroApp = CreateObject("AcroExch.App")
Set p_VDoc = CreateObject("AcroExch.AVDoc")
Call p_VDoc.Open(srcFilename, "")
Set p_VDoc = p_AcroApp.GetActiveDoc
If p_VDoc.IsValid Then
Set p_DDoc = p_VDoc.GetPDDoc
' Fill in pdf properties.
p_DDoc.SetInfo "Title", Format(Date, "dd-mm-yyy")
p_DDoc.SetInfo "Subject", srcFilename
If p_DDoc.Save(1 Or 4 Or 32, destFilename) <> True Then
MsgBox "Failed to save " & srcFilename
End If
p_DDoc.Close
End If
'Close the PDF
p_VDoc.Close True
p_AcroApp.Exit
'Clear Variables
Set p_DDoc = Nothing
Set p_VDoc = Nothing
Set p_AcroApp = Nothing
End Sub
What I need;
1) to be able to set the font face of the destination file ( destFilename)
2) to be able to set the font size of the destination file ( destFilename)
Am using Adobe Acrobat 7.0 Type Library
Kindly Help.
Thanks in advance
We didn't say it doesn't work. We said it isn't supported.
There are a number of other ways to make a PDF. The one which would
give the most control is if your application directly printed to GDI,
controlling the font directly. This could print to Adobe PDF.
You could look for an application that gives control of font for
printing.
You could use a text-to-PostScript system and distill the result. You
could even look for a non-Adobe text-to-PDF.
Working in the unsupported and dangerous world you chose, the font
size for text conversion is set (and this is very bad design from
Adobe) in the settings for Create PDF > From Web Page. There is no API
to this.
Aandi Inston
Similar Messages
-
Converting Multiple .EPS files into .PDF
Dear Forum: We have tried converting multiple .eps files into PDF using article 325977. This article in Adobe help is really designed to convert .ai files into either .eps or.pdf, our situation is to convert multiple .eps files into PDF. Everytime we run the macro, it simply takes the eps file and saves it as another eps file and does not convert. We have a "Save As" step that we have in the macro that is set to "Save As" PDF, but it still does not work. What are we doing wrong?
Hi mephisto11757,
You can convert the following file types to PDF with the Adobe CreatePDF service:
Adobe Creative Suite® file formats Examples include: .psd, .ai, .indd
Microsoft Word (2000, XP, 2003, 2007, 2010, & 2011) .doc, .docx
Microsoft Excel (2000, XP, 2003, 2007, 2010, & 2011) .xls, .xlsx
Microsoft PowerPoint (2000, XP, 2003, 2007, 2010, & 2011) .ppt, .pptx
Microsoft Publisher (2000, XP, 2003, 2007, 2010, & 2011) .pub
Text Files .txt
Rich Text Format .rtf
Adobe PostScript .ps
OpenOffice Format .odt
Star Office .sxw, .sxi, .sxc, .sxd, .stw
Corel WordPerfect .wpd
Image file formats .gif, .png, .jpg, .bmp, .tiff
Regards,
Florence -
To convert multiple image files to pdf using pdfsharp in C#
Hey guys I have this C# code to convert any image file to .pdf using pdfsharp.dll. But I want to select multiple images for conversion please help. here's my code (plz note enable pdfsharp.dll in the reference)
usingSystem;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Threading.Tasks;
usingPdfSharp.Pdf;
usingPdfSharp.Drawing;
usingSystem.IO;
namespaceConsoleApplication1
classProgram
staticvoidMain(string[]
args)
PdfDocumentdoc =
newPdfDocument();
doc.Pages.Add(newPdfPage());
XGraphicsxgr =
XGraphics.FromPdfPage(doc.Pages[0]);
XImageimg =
XImage.FromFile(source
path...);
xgr.DrawImage(img,0,0);
doc.Save(destination path...);
doc.Close();try this one
public string CreatePDF(System.Collections.Generic.List<byte[]> images)
dynamic PDFGeneratePath = Server.MapPath("../images/pdfimages/");
dynamic FileName = "attachmentpdf-" + DateTime.Now.Ticks + ".pdf";
if (images.Count >= 1) {
Document document = new Document(PageSize.LETTER);
try {
// Create pdfimages directory in images folder.
if ((!Directory.Exists(PDFGeneratePath))) {
Directory.CreateDirectory(PDFGeneratePath);
// we create a writer that listens to the document
// and directs a PDF-stream to a file
PdfWriter.GetInstance(document, new FileStream(PDFGeneratePath + FileName, FileMode.Create));
// opens up the document
document.Open();
// Add metadata to the document. This information is visible when viewing the
// Set images in table
PdfPTable imageTable = new PdfPTable(2);
imageTable.DefaultCell.Border = Rectangle.NO_BORDER;
imageTable.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
for (int ImageIndex = 0; ImageIndex <= images.Count - 1; ImageIndex++) {
if ((images(ImageIndex) != null) && (images(ImageIndex).Length > 0)) {
iTextSharp.text.Image pic = iTextSharp.text.Image.GetInstance(SRS.Utility.Utils.ByteArrayToImage(images(ImageIndex)), System.Drawing.Imaging.ImageFormat.Jpeg);
// Setting image resolution
if (pic.Height > pic.Width) {
float percentage = 0f;
percentage = 400 / pic.Height;
pic.ScalePercent(percentage * 100);
} else {
float percentage = 0f;
percentage = 240 / pic.Width;
pic.ScalePercent(percentage * 100);
pic.Border = iTextSharp.text.Rectangle.BOX;
pic.BorderColor = iTextSharp.text.BaseColor.BLACK;
pic.BorderWidth = 3f;
imageTable.AddCell(pic);
if (((ImageIndex + 1) % 6 == 0)) {
document.Add(imageTable);
document.NewPage();
imageTable = new PdfPTable(2);
imageTable.DefaultCell.Border = Rectangle.NO_BORDER;
imageTable.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER;
if ((ImageIndex == (images.Count - 1))) {
imageTable.AddCell(string.Empty);
document.Add(imageTable);
document.NewPage();
} catch (Exception ex) {
throw ex;
} finally {
// Close the document object
// Clean up
document.Close();
document = null;
return PDFGeneratePath + FileName; -
Converting multiple bmp files to PDF using acrobat 7.0 from DOS prompt
Hi,
I have a requirement to convert multiple BMP files in a folder to one PDF.
I can use multiple file conversion option in acrobat to combine and convert them to one PDF .. but I have 2000 such folder to conver to PDF.
PDF should be name after the folder name.
Is there a to automate this in acrobat.. or can we run this conversion from DOS prompt using commands.. so that I can create a bat file and have them converted. Pls let me know.
Thanks
PugazhI have not tried BMP files, but do JPeg, GIF, TIFF, and PNG files regularly. I simply open Acrobat, then select the graphics files in explorer and drag & drop to Acrobat. I then organize the graphics if needed (using the pages tab) and save to a PDF.
-
How to convert the TEXT file into an XML using plsql code
Hi all ,
I need to convert an TEXT file into an XML file how can i do it
Below is my sample TEXT file .
TDETL00000000020000000000000120131021115854ST2225SKU77598059 0023-000000010000
I want the above to be converted into the below format
<?xml version="1.0" encoding="UTF-8"?>
<txt2xml>
<!-- Processor splits text into lines -->
<processor type="RegexDelimited">
<regex>\n</regex>
<!--
This is used to specify that a message should be created per line in
the incoming file;
NOTE: this was designed to work with all the processors, however it
only works correctly with 'RegexDelimited' processors (check the
enclosing top processor type)
-->
<maxIterationsPerMsg>1</maxIterationsPerMsg>
<!-- For lines beginning with FHEAD (File Header) -->
<processor type="RegexMatch">
<element>FHEAD</element>
<regex>^FHEAD(.*)</regex>
<processor type="RegexMatch">
<element>OriginalLine</element>
<regex>(.*)</regex>
<consumeMatchedChars>false</consumeMatchedChars>
</processor>
<processor type="RegexMatch">
<element>LineSeq,Type,Date</element>
<regex>^(\d{10})(\w{4})(\d{14})$</regex>
</processor>
</processor>
<!-- For lines beginning with TDETL (Transaction Details) -->
<processor type="RegexMatch">
<element>TDETL</element>
<regex>^TDETL(.*)</regex>
<processor type="RegexMatch">
<element>OriginalLine</element>
<regex>(.*)</regex>
<consumeMatchedChars>false</consumeMatchedChars>
</processor>
<processor type="RegexMatch">
<element>LineSeq,TransControlNumber,TransDate,LocationType,Location,ItemType,Item,UPCSupplement,InventoryStatus,AdjustReason,AdjustSign,AdjustQty</element>
<regex>^(\d{10})(\d{14})(\d{14})(\w{2})(\d{4})(\w{3})([\w ]{13})([\w ]{5})(\d{2})(\d{2})([+-]{1})(\d{12})$</regex>
</processor>
</processor>
<!-- For lines beginning with FTAIL (File Tail) -->
<processor type="RegexMatch">
<element>FTAIL</element>
<regex>^FTAIL(.*)</regex>
<processor type="RegexMatch">
<element>OriginalLine</element>
<regex>(.*)</regex>
<consumeMatchedChars>false</consumeMatchedChars>
</processor>
<processor type="RegexMatch">
<element>LineSeq,TransCount</element>
<regex>^(\d{10})(\d{6})$</regex>
</processor>
</processor>
</processor>
</txt2xml>
ThanksSorry, that doesn't make much sense.
The XML you gave is a configuration file for txt2xml utility. It doesn't represent the output format.
Are you a user of this utility? -
HI,
I created a new adobe account. I want to convert a doc file into pdf. How to do that?
I have seen a Create pdf menu and under that Convert office files to pdf. But I can't click it, why?
How to convert my doc file to pdf?Hello,
if you create your doc files by the help of WORD, you could use a Microsoft add on (it depends of your WORD Version).
Hans-Günter -
How to convert a .alsx file into pdf
How to convert a .alsx file into pdf
Iam facing this problem since many days please resolve it
http://www.roothow.com
Thankls in adavance>But, from the windows explorer, if i do a right clic on the word document, with the context menu, i can directly convert to PDF
This is equivalent to using the PDFMaker facility in Word - that is,
the Acrobat button. Which is also the same thing that is done when you
use File > Create PDF > From File in Acrobat.
What it does is print to a PS file *and* do a lot of additional
processing to write stuff about links, tags etc. into the PS file.
>(no tmp PS file is used, cause the links are still working).
This isn't true, but it's certainly the case that you won't get links.
There seems to be no API, via any mechanism, still less the "obsolete"
(Microsoft's view) command line, to use PDFMaker from your program.
Aandi Inston -
Converting a text file into a String
I need to convert a text file (in whatever format, in my case it would be xml and xsl files) in a String.
I made this methods:
public static String createStringFromFile(File f) {
StringBuffer buf = new StringBuffer();
try {
FileInputStream fInp = new FileInputStream(f);
byte[] byteArray = new byte[fInp.available()];
int bLetti = fInp.read(byteArray);
if (bLetti == fInp.available()) {
for (int i=0; i<fInp.available(); i++)
buf.append(Byte.toString(byteArray));
else
throw (new IOException("Errore nella lettura del file"));
fInp.close();
} catch (Exception e) {
ErrorManager.getError(e);
return (buf.toString());
public static String createStringFromFile(String fileName) {
StringBuffer buf = new StringBuffer();
try {
FileInputStream fInp = new FileInputStream(fileName);
byte[] byteArray = new byte[fInp.available()];
int bLetti = fInp.read(byteArray);
if (bLetti == fInp.available()) {
for (int i=0; i<fInp.available(); i++)
buf.append(Byte.toString(byteArray[i]));
else
throw (new IOException("Errore nella lettura del file"));
fInp.close();
} catch (Exception e) {
ErrorManager.getError(e);
return (buf.toString());
There are no compilation or runtime errors, but the result string is empty. Not null, empty. What should I do? :)Do you really want to use bytes and so on when java does it all for you?
Here's how I did it, hope it's useful.
public String getFileAsString(String fileName){
StringBuffer buffer = new StringBuffer();
try{
BufferedReader bRead = new BufferedReader(new FileReader(new File(fileName)));
String str = "";
while( (str = bRead.readLine()) != null ){
buffer.append(str);
}//end while
bRead.close();
}catch(Exception e){
System.err.println("in getFileAsString(): " + e.toString());
}//end try
return buffer.toString();
}//end getAsString() -
Converting a word 2000 file into pdf using Adobe Acrobat Standard X
I reinstalled my Adobe Acrobat Standard X today, and tried to convert a *.doc word file into pdf, but the application could not open the word file and got stalled. I remembered that last time I installed the application the same probelm cropped up and I had to install a Microsoft patch that was required to do this, What is the patch file and how do I get it?
I answer my question myself. I have solved it myself. The answer can be found by searching adobe website. But I give it here if it can be useful to others. Go to control panel. Go to Add or remove programs. Click on Modify in the listed Adobe program. Click Next in the box that appears. Select Modify. Click on + sign against pdF maker to expand. Click on X sign against 'this feature is not available' which shifts on to the little box on the left of Microsoft Office. Click on Apply. Quit. Once the Microsoft Office becomes disabled in Adobe, Word will open in all places.
-
I downloaded the trial version of Adobe XL for converting a Word doc into PDS - can't find it now. Need asap!
You want the forum for Acrobat then: Acrobat
-
Converting multiple msft files into one pdf
HELP - i am using adobe acrobat 9 pro for macs (Mac OS X 10.6.3). when we had a pc, we were able to convert multiple files (microsoft office) to a single pdf at once without first converting them all to pdf. when I attempt this using the same technique, the images for all documents other than pdf files are greyed out and it seems that word/office documents are not a supported format for the conversion of multiple files (not listed in drop down menu) into one pdf.
I would greatly appreciate help with this. we are business users who are new to macs. we need to do a lot of this and are getting so frustrated. Thanks in advance!Hi mephisto11757,
You can convert the following file types to PDF with the Adobe CreatePDF service:
Adobe Creative Suite® file formats Examples include: .psd, .ai, .indd
Microsoft Word (2000, XP, 2003, 2007, 2010, & 2011) .doc, .docx
Microsoft Excel (2000, XP, 2003, 2007, 2010, & 2011) .xls, .xlsx
Microsoft PowerPoint (2000, XP, 2003, 2007, 2010, & 2011) .ppt, .pptx
Microsoft Publisher (2000, XP, 2003, 2007, 2010, & 2011) .pub
Text Files .txt
Rich Text Format .rtf
Adobe PostScript .ps
OpenOffice Format .odt
Star Office .sxw, .sxi, .sxc, .sxd, .stw
Corel WordPerfect .wpd
Image file formats .gif, .png, .jpg, .bmp, .tiff
Regards,
Florence -
Converting a text file into a PDF? PLZ help
hi all,
i need some help !
i have a text file which i'm reading in to array of bytes and then i insert the bytes into an output stream.
now i want to send this file to the client browser where it would open Adobe acrobat reader and display the contents .
I'm using a servlet to acheive this and i've set the response.setContent("application/pdf")
the obvious problem is Acrobat reader is not able to open the contents.
is there a work around for this?
i would be grateful if anyone could come up with a solutionHello.
http://www.lowagie.com/iText/ -
VBScript for parsing multiple text files
Hi,
I have around 175 text files that contain inventory information that I am trying to parse into an Excel file. We are upgrading our Office platform from 2003 to 2010 and my boss wants to know which machines will have trouble supporting it. I found a script
that will parse a single text file based upon ":" as the delimiter and I'm having trouble figuring out how to change it to open an entire folder of text files and write all of the data to a single Excel spreadsheet. Here is an example of the text
file I'll be parsing. I'm interested in the "Memory and Processor Information" and "Disk Drive Information" sections mainly.
ABEHRENS-XP Computer Inventory
OS Information
OS Details
Caption: Microsoft Windows XP Professional
Description:
InstallDate: 20070404123855.000000-240
Name: Microsoft Windows XP Professional|C:\WINDOWS|\Device\Harddisk0\Partition1
Organization: Your Mom
OSProductSuite:
RegisteredUser: Bob
SerialNumber: 55274-640-3763826-23029
ServicePackMajorVersion: 3
ServicePackMinorVersion: 0
Version: 5.1.2600
WindowsDirectory: C:\WINDOWS
Memory and Processor Information
504MB Total memory HOW CAN I PULL THIS WITHOUT ":" ALSO
Computer Model: HP d330 uT(DG291A)
Processor: Intel(R) Pentium(R) 4 CPU 2.66GHz
Disk Drive Information
27712MB Free Disk Space ANY WAY TO PULL THIS WITHOUT ":"
38162MB Total Disk Space
Installed Software
Here is the start of the script I have so far. . .
Const ForReading = 1
Set objDict = CreateObject("Scripting.Dictionary")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("C:\Test\test.txt" ,ForReading)
WANT THIS TO BE C:\Test
Do Until objTextFile.AtEndOfStream
strLine = objTextFile.ReadLine
If Instr(strLine,":") Then
arrSplit = Split(strLine,":") IS ":" THE BEST DELIMITER TO USE?
strField = arrSplit(0)
strValue = arrSplit(1)
If Not objDict.Exists(strField) Then
objDict.Add strField,strValue
Else
objDict.Item(strField) = objDict.Item(strField) & "||" & strValue
End If
End If
Loop
objTextFile.Close
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
intColumn = 1
For Each strItem In objDict.Keys
objExcel.Cells(1,intColumn) = strItem
intColumn = intColumn + 1
Next
intColumn = 1
For Each strItem In objDict.Items
arrValues = Split(strItem,"||")
intRow = 1
For Each strValue In arrValues
intRow = intRow + 1
objExcel.Cells(intRow,intColumn) = strValue
Next
intColumn = intColumn + 1
Next
Thank you for any help.You are The Bomb.com! I had to play around with it to pull some additional data (model and processor) and then write a quick macro to remove the unwanted text and finally I wanted the data to write in columns instead of rows so this is what I ended up with:
Option Explicit
Dim objFSO, objFolder, strFolder, objFile
Dim objReadFile, strLine, objExcel, objSheet
Dim intCol, strExcelPath
Const ForReading = 1
strFolder = "c:\Test"
strExcelPath = "c:\Test\Inventory.xlsx"
Set objExcel = CreateObject("Excel.Application")
objExcel.Workbooks.Add
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
intCol = 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strFolder)
For Each objFile In objFolder.Files
intCol = intCol + 1
Set objReadFile = objFSO.OpenTextFile(objFile.Path, ForReading)
Do Until objReadFile.AtEndOfStream
strLine = objReadFile.ReadLine
If (InStr(strLine, "Computer Inventory") > 0) Then
objSheet.Cells(intCol, 1).Value = Left(strLine, InStr(strLine, "Computer Inventory") - 2)
End If
If (InStr(strLine, "Total memory") > 0) Then
objSheet.Cells(intCol, 2).Value = Left(strLine, InStr(strLine, "Total memory") - 2)
End If
If (InStr(strLine, "Computer Model:") > 0) Then
objSheet.Cells(intCol, 3).Value = (strLine)
End If
If (InStr(strLine, "Processor:") > 0) Then
objSheet.Cells(intCol, 4).Value = (strLine)
End If
If (InStr(strLine, "Total Disk Space") > 0) Then
objSheet.Cells(intCol, 5).Value = Left(strLine, InStr(strLine, "Total Disk Space") - 2)
End If
If (InStr(strLine, "Free Disk Space") > 0) Then
objSheet.Cells(intCol, 6).Value = Left(strLine, InStr(strLine, "Free Disk Space") - 2)
End If
Loop
Next
objExcel.ActiveWorkbook.SaveAs strExcelPath
objExcel.ActiveWorkbook.Close
objExcel.Quit
Thanks again!
Hi ,
I am have very basic knowledge about VB scripting, but this code could be the perfect solution i am looking for. could you guide me exactly how to run and test the same , i would be really thankful for your kind and generous support on this.
Thanks ,
Veer -
Converting a text file into an array
import java.io.*;
public class Copy {
public static void main(String[] args) throws IOException {
File inputFile = new File("farrago.txt");
File outputFile = new File("outagain.txt");
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1)
out.write(c);
in.close();
out.close();
i have been working my way through the online tutorials and have found them very helpful, i have looked at array and would like to know how to convert data from a text file inot an array? using the above example how would i go about doing this?You'd use the readLine () method:BufferedReader reader = new BufferedReader (new FileReader (file));
String line;
List list = new LinkedList ();
while ((line = reader.readLine ()) != null) {
list.add (line);
// don't know why you'd want this, but anyway
String[] lines = (String[]) list.toArray (new String[list.size ()]);Kind regards,
Levi -
How can i convert a .indd file into pdf
please help on this
How can i convert .indd file to pdf file using .net c#
please share some code sample for a better helpHi there,
There's actually an easy streamlined way to do this using Acrobat.com. Here are the steps:
1. Log in to Acrobat.com with your Adobe ID.
2. On the left, you'll see a navigation menu that includes the item "Import and Edit". Click that.
3. Choose the .doc (Word) file you want to convert and upload it to Buzzword.
4. After making sure that it looks the way you want it to, go to the top menu (still in Buzzword now, not the organizer where all your files live) and click the document menu. There will be an option to "Export" - choose that.
5. When prompted to select filetype, choose "Adobe PDF" and press OK.
6. It'll save to your desktop, so now you have to get it into your acrobat.com organizer. To do that, close the Buzzword document by clicking the little "x" in the upper right corner, under the Sign Out button. This'll get you back to your organizer, where you can choose "Import" from the left nav menu again. This time choose your new PDF file.
7. Select the file icon in the organizer and click the Share button. Or, select Share from the file context menu.
8. Select Allow Anyone With A Link To Share This Document to set the document to open access, and then click Copy Embed Code. The necessary HTML code to embed the preview is copied onto the clipboard.
9. Open the HTML file and paste the code into the file. The Flash previewer can display any file type that you can convert to PDF.
Hope this helps! Good luck, and let us know how it works out.
Rebecca
Maybe you are looking for
-
Audition CS6 deleting/trimming issues
Hi All, I'm experimenting with CS6 in an effort to replace Audition 3.0 which crashes all the time lately. I noticed that several features work different and I can't find the way to make them work correctly. - In waveform mode, if I trim a recorded a
-
WRT350N - Storage Feature Performance
Yesterday I purchased the WRT350N. The 'other' gigabit wireless router was $130. The WRT350N was $199. The reason I paid the difference was for the storage access feature. I have an external HD that was connected to a desktop. In the house we use lap
-
Query on MCJC - MTTR/MTBR Functional Location report in Plant Maintenance
We have recently upgraded our SAP 4.7 system to mySAP ERP 2005 ecc6.0. We are facing problem in report derived using tcode'MCJC' in Plant Maintenance.When we execute MCJC (MCJC - MTTR/MTBR Functional Location ) transaction, there is no data appearing
-
Any Layout Similar to HTML Tables'?
Is there any layout which would adapt each column and row to its contents so, for example, a panel might end up like this: | | | |__|_| |__|_|but the several cells would never be misaligned?
-
Outlook/Outlook Express .dbx files
Is there a way to read Outlook Express .dbx files? Any free library or something like that?