PDA

View Full Version : Header changed when save as PDF file


Unregistered
October 14, 2002, 18:51:00
Hi there,

I load a rtf as a template file and insert an image into the header of the file. I have two problems:

1. when I insert the image into an existed header(load from the rtf fiel), The image remove all the header.

With TXControl1
.HeaderFooter = .HeaderFooter + Tx4oleLib.HeaderFooterConstants.txHeader
.HeaderFooterSelect(Tx4oleLib.HeaderFooterConstant s.txHeader)
.SelStart = 0
.ObjectInsertAsChar(0, strImagePath, -1, 100, 100, 0, 1)
.HeaderFooterSelect(0)
.HeaderFooterActivate(Tx4oleLib.HeaderFooterConsta nts.txHeader)
end with

2. if I didn't insert the image, I save the content of the TXControl as RTF file, there is no problem with the header. But When I save it as a PDF file, it only show part of the header.

Any helps?

Thanks.

Yolande


This message was originally posted by Yolande in the old TX Text Control Support Forum.

Unregistered
October 14, 2002, 20:27:04
Hi There,

Can I use
intPosition = (InStr(intBeginSearch, TXControl.CtlText, "/Effective Date/", CompareMethod.Text))
to find the particular content in the header? I tried but find nothing. Is it because "TXControl.CtlText" is not the content of header? Then how can I find and replace the text?

Thanks.

Yolande


This message was originally posted by Yolande in the old TX Text Control Support Forum.

Björn Meyer
October 15, 2002, 15:54:49
Hello Yolande

You should activate the header before using the Text or better the SelText property of TX Text Control.

.HeaderFooterActivate = txHeader
.SelStart = 0
.SelLength = -1
sString = .SelText

Could you describe your second problem a little more detailed?

Björn Meyer, TX Text Control


This message was originally posted by Björn Meyer in the old TX Text Control Support Forum.

Unregistered
October 15, 2002, 16:47:28
Hi Meyer,

1. I changed the code, activated the header before I used it. The strange thing is the image replace everything. So the final file is only the image.

2. Why when I save it as a PDF file, it only show part of the header.

3. I load a RTF file to the TXControl. I need to insert an image and replace something in the header. I try to find the content in header to be replaced using

intPosition = (InStr(1, TXControl1.CtlText, "/Effective Date/",
CompareMethod.Text))
or
intPosition = TXControl1.Find("/Effective Date/", 1, 0)

But no one will work. Is there any way to find the text in header?

The code is as following: I call this procedure after I load the RTF file to TXControl.

Private Sub SetHeader()
Dim intPosition As Integer = 1
Dim blnHasLogo As Boolean
Dim strImagePath As String
With TXControl
.HeaderFooter = .HeaderFooter + Tx4oleLib.HeaderFooterConstants.txHeader
.HeaderFooterSelect(Tx4oleLib.HeaderFooterConstant s.txHeader)
.HeaderFooterActivate(Tx4oleLib.HeaderFooterConsta nts.txHeader)
strImagePath = "C:\logo.jpg"
.SelStart = 0
.SelLength = -1
.ObjectInsertAsChar(0, strImagePath, -1, 100, 100, 0, 1)

intPosition = (InStr(1, TXControl.CtlText, "/Effective Date/", CompareMethod.Text)) - 1
'intPosition = TXControl.Find("/Effective Date/", 1, 0) - 1
If intPosition > 0 Then
.SelStart = intPosition
.SelLength = 16
.SelText = Now().ToShortDateString()
End If
.HeaderFooterSelect(0)
End With
End Sub


Thanks

Yolande


This message was originally posted by Yolande in the old TX Text Control Support Forum.

Björn Meyer
October 15, 2002, 17:51:12
1. <i>I changed the code, activated the header before I used it. The strange thing is the image replace everything. So the final file is only the image.</i>

Okay, let's see what you did:

.SelStart = 0
.SelLength = -1
.ObjectInsertAsChar(0, strImagePath, -1, 100, 100, 0, 1)

You select the complete header and insert an image. All other content will be gone. Sel the current input position into header and insert an object into that position.

2. I am not able to reproduce this issue, as I previously wrote in the last post.

3. If the content is deleted the Find method cannot find anything. See 1.

Björn Meyer, TX Text Control


This message was originally posted by Björn Meyer in the old TX Text Control Support Forum.

Unregistered
October 15, 2002, 18:22:54
Thank you Meyer,

The find and replace is working now. And I also insert an image into the header. The problem is that the PDF file shows the part of the header. And it changes the position of some contents in header. The header I saved in RTF file is like this:

Logo.jpg SYSTEM LEVEL PROCEDURE DOC# P-100
Effective Date Subject page X of Y
10/15/2002 Making Coffee


But the PDF file only shows

Logo.jpg SYSTEM LEVEL PROCEDURE
DOC# P-100
and it moves DOC# P-100 to next line. I set the page of the TXControl like this:

.PageWidth = 12000
.PageHeight = 15000
.PageMarginB = 1000
.PageMarginL = 1000
.PageMarginR = 1000
.PageMarginT = 1000
.ViewMode = 2

I changed the setting, but it is no use.

Thanks.

Yolande


This message was originally posted by Yolande in the old TX Text Control Support Forum.

LouGar
July 29, 2003, 18:23:01
I am having the same problem as Yolande. I am inserting a body, and header and footer in a document. When I save as Word format, it comes out fine. WHen I save in PDF, only the first 2 lines of a 7 line header apears.

However, if I break before the save, i.e. wait a second between inserting the header, and saving, the document will come out fine as PDF.

Any suggestions?

Thanks,

Lou

gg6642@dfa.state.ny.us