View Full Version : Saving as PDF
eingen
September 30, 2004, 23:28:01
I am using TX Text Control ActiveX Server v11/SP1 in a .Net web service application written in C#.
When I load a MS Word template using TX TextControl ActiveX Server and then try to save as PDF, the file size increases dramatically and when I view it in Acrobat, the page seems corrupted. It starts out at 690% view, and when I reduce to 100%, the document is very narrow and impossible to read. Here is the source code:
string templateFilePath = letterSavePath + "\\" + _formLetterName + ".doc";
theTXControl.Load(templateFilePath,0,9,true);
string _targetPath = letterFinalPath + "\\" + outputFileName;
theTXControl.Save(_targetPath,0,12,true);
Any suggestions would be much appreciated!
Björn Meyer
October 1, 2004, 15:07:59
Erik
1. You should specify a page size. This can be done using the LoadSaveAttribute property.
TX1.Load(file,0,9,false)
TX1.PageWidth = TX1.LoadSaveAttribute(txDocWidth)
...
2. All images will be saved as WMF as default. Please use the ImageExportFilters property to specify another filter like JPG. Additionally, the resolution can be set using the LoadSaveAttribute property:
TX1.LoadSaveAttribute(txImageMaxResolution) = 96
TX1.Save(file,0,12,false)
eingen
October 1, 2004, 16:27:02
Bjorn, Thanks for responding so quickly. However, I am unable to see or use these properties in my code. The help pages for the control list a LoadSaveAttribute property, but when I type theTXControl.; I do not see it listed as an available property...
private Tx4oleLib.TXTextControlClass theTXControl;
theTXControl = new TXTextControlClass();
theTXControl.Load(docTemplateFile,0.9,false);
theTXControl. (No property/method called "LoadSaveAttribute")...
I see a "get_LoadSaveAttribute" and a "set_LoadSaveAttribute" but am getting errors trying to use them...
eingen
October 1, 2004, 16:47:43
Nevermind. I've figured it out!
eingen
October 1, 2004, 18:02:44
How do I use the ImageExportFilters property to specify an image filter?
mszilagyi
March 7, 2006, 07:06:58
bumping this up as i'm having a similar problem. When I try to do
TXTextControl.ImageExportFormat = <value>
i get back a error saying that the value can't be set; object w/specified ID probably doesn't exist. Is there something I'm not getting with what has to be done to do this?
Björn Meyer
March 7, 2006, 10:13:54
You have to specify the current object first using the ObjectCurrent property.
TX1.ObjectCurrent = 1
TX1.ImageExportFormat = ...
To change the format of all images, you can utilize a loop and the ObjectNext method which returns the next object id.
mszilagyi
March 7, 2006, 19:19:15
This worked perfectly. Thanks alot.