It seems so the wrong file was posted, a newer demo is
https://www.wpcubed.com/ftp/WPFormDemo567.zip
Thanks for reporting this problem
It seems so the wrong file was posted, a newer demo is
https://www.wpcubed.com/ftp/WPFormDemo567.zip
Thanks for reporting this problem
I resent it. The caption is 'Re: Using wPDFControl with ASP.NET'
Currently WPViewPDF is not released for Windows 98. Sorry about that.
Thanks for this hint - no the DC was forgotten. The code should read like:
public bool PrintTo(uint PageNO, Graphics Canvas, uint ResX, uint ResY) { bool res; IntPtr DC = Canvas.GetHdc(); Command(commands.COMPDF_PrintHDCSetXRes, ResX); Command(commands.COMPDF_PrintHDCSetYRes, ResY); Command(commands.COMPDF_PrintHDCSetHDC, DC.ToInt32()); res = (Command(commands.COMPDF_PrintHDC, PageNO) >= 0); Canvas.ReleaseHdc(DC); GC.KeepAlive(Canvas); return res; }
Please also update:
public System.Drawing.Imaging.Metafile GetMetafile(uint PageNo)
{
Bitmap RefBitmap = new Bitmap(10,10);
Graphics RefCanvas = Graphics.FromImage(RefBitmap);
IntPtr DC = RefCanvas.GetHdc();
System.Drawing.Imaging.Metafile ResMeta =
new System.Drawing.Imaging.Metafile(DC,
System.Drawing.Imaging.EmfType.EmfOnly,
"Created by wpViewPDF for .NET - www.PDFCONTROL.com");
RefCanvas.ReleaseHdc(DC);
Graphics aCanvas = Graphics.FromImage(ResMeta);
aCanvas.Clear(Color.White);
if(!PrintTo(PageNo,aCanvas,(uint)RefCanvas.DpiX,(uint)RefCanvas.DpiY))
{
ResMeta.Dispose();
ResMeta = null;
}
return(ResMeta);
}
Alles anzeigen
...Ah, dann hat sich meine e-mail erledigt.
Das Problem wurde bereits berichtet und ist in Arbeit. Die Lösung
sollte nächste Woche da sein.
I sent you a changed DLL vie e-mail. I tried to run the example - thanks for that - but failed until now.
Wrap arround is not possible, but you can change the WordWrapMode for objects which are connected to a paragraph to allow left or right wrapping.
WPRichText1.TextObjects.ChangePositionMode( CurrentPTextObj, wpotPar, wpwrAutomatic);
is an object reference, for example the one provided to the TextObject events.
If you insert a new object you can se the properties
WPRichText1.TextObjects.DefaultPositionMode
WPRichText1.TextObjects.DefaultWrapMode
It uses an InputQuery - see unit WPRich.PAS, function TWPCustomRichText.EditHyperlink: Boolean;
Yes, it is there. It is in WPWinCTR.PAS. If you are using the WPReport demo you need to disable it (in file WPINC.INC) and copy the two source files WPWinCTR.PAS and WPPrint.PAS from directory Source. But the next release will be posted soon and it will also include this improvement.
There is a problem in the source of WPRich. The parameter is not passed to the caller since var was not specified.
For thios version you may modify unit WPRich.PAS
procedure TWPCustomRichText.DoAfterCompleteWordEvent(var key: char);
Do you use the RTF2PDF module or the standard PDFControl?
In RTF2PDF we today found and fixed a problem and will post the update a.s.a.p.
For a quick replacement of all fonts in the text with one use this loop:
Delphi:
for i:=0 to FONTMAXANZ do
WPRichText1.Header.FontName[i] := 'Courier Dark';
WPRichText1.ReformatAll;
C++Builder:
for(int i=0; i<=FONTMAXANZ; i++)
WPRichText1->Header->FontName[i] = "Courier Dark";
WPRichText1->ReformatAll();
The code with HideInsertpoints is not required. Simply switch on 'Hidden' in the property InsertpointTextAttr.
I hope this helps,
Julian Ziersch
a) and c) are connected. In unit WPWrite2 (line 463..) you will find the code which converts the fields into text:
p := FMemo.TxtObjLst.Data[save_pa^.tag]; // V4.x
if (p <> nil) and (p^.obj <> nil) and (p^.obj is TWPObjectField) then
...
Here it is possible to add special code to handle fields which are not always known at export time, most important PAGE and NUMPAGES:
if (p <> nil) and (p^.obj <> nil) and (p^.obj is TWPObjectField) then
begin
{$IFDEF USEFIXEDPAGENUMS}
if CompareText( TWPObjectField(P^.obj).FieldName, 'PAGE')=0 then s := '1'
else
if CompareText( TWPObjectField(P^.obj).FieldName, 'NUMPAGES')=0 then s := '1'
else
{$ENDIF USEFIXEDPAGENUMS}
begin
TWPObjectField(P^.obj).AliasTextObj := P;
TWPObjectField(P^.obj).Memo := FMemo;
TWPObjectField(P^.obj).ParPTR := save_par;
TWPObjectField(P^.obj).LinePTR := save_lin;
TWPObjectField(P^.obj).PosInLine := save_pos;
FMemo.FieldPageNumber := save_lin^.pagenum + 1;
s := TWPObjectField(P^.obj).GetFieldText(FALSE);
end;
if s <> '' then fpOut.Write(PChar(s)^, Length(s));
end;
Alles anzeigen
b) I assume each record means 'each page'? The #10#13 codes are written in procedure WriteParagraphEnd and it apperas to be to be the correct way in ANSI mode.
(Note: I combined your two posts since they were related)
Julian Ziersch
>>1) speed: sometimes the characters appear as fast as I type them, and other times the display of characters is considerably behind my typing. I do not know what kind of processing is required in the background, and I wish I could provide more information as to when it occurs. Do you have any ideas? <<
RightToLeft writing should not reduce the speed characters are inserted since in memory they of course are inserted left-to-right so the same code is running. If there is a dealy maybe you have a running process on your system consuming a lot of CPU? I had that in the past quite often.
>>2) backspace key: the backspace key does nothing in right-to-left mode. It should delete the last character typed. <<
In V4.20 it should work alright - I just tested it.
>> 3) disappearing characters on right: text is normally right justified. When you type a space, the entire line moves to the right, hiding part of the first character on the line (the character on the right). As you type more spaces, more characters on the right are hidden. As soon as you type a non-space character, the line moves to the left and all characters come into view. This also occurs during word-wrapping if a space is the last character in the line of a paragraph. <<
I can see that.
>> 4) what is the difference between the wpRightToLeft and wpAutoRightToLeft settings? My thought was that wpRightToLeft forced the mode all of the time and the wpAutoRightToLeft setting used the current Windows language mode. Is this correct?<<
The language mode is not used, the font is used. So if you are using arabic or hebrewic fonts it switches to RTL otherwise use LTR. This is the mode which works most like Word.
Julian Ziersch
ZitatAs usual superlative service from your firm.
Thank you very much.
Many thanks!
Julian
To preset the unit used in all TWPValueEdit (the spin edits) use the global variable:
GlobalValueUnit := euInch
or
GlobalValueUnit := euCm;
Using a right click on the edit control let the user switch to a different unit.
To preset the unit used in all TWPValueEdit (the spin edits) use the global variable:
GlobalValueUnit := euInch
or
GlobalValueUnit := euCm;
Using a right click on the edit control let the user switch to a different unit.
Yes, this is easy.
Use the event PrintHeader to print directly to the Printer.Canvas.
For a solution which also paints the information in the editor check out the WtareMarke demo, esspecially the function DrawPage and property ViewOptions.
With the licensed version of WPViewPDF do this:
var pdf : TWPViewPDF;
meta : TMetafile;
page : Integer;
bit : TBitmap;
jpeg: TJPEGImage;
path : String;
begin
path := ExtractFilePath(Application.EXEName);
// Set WPViewPDF DLL name:
WPViewPDFDLLNAME := 'wPDFView01.dll';
// Install PDF License
WPPDFViewerStart('LICNAME','LICKEY',LICCODE);
// Create a Viewer
pdf := TWPViewPDF.Create(nil);
// Currently we need a parent
pdf.SetBounds(-10,-10,1,1);
pdf.Parent := Self;
page := StrToIntDef( PageNr.Text, 1);
try
pdf.LoadFromFile(FileName.Text);
meta := pdf.GetMetafile(page);
if meta<>nil then
try
if (FormatName.Text='BMP') or (FormatName.Text='JPEG') then
begin
bit := TBitmap.Create;
try
bit.Width := Round(meta.MMWidth /10);
bit.Height := Round(meta.MMHeight /10);
bit.Canvas.StretchDraw(bit.Canvas.ClipRect, meta);
if FormatName.Text='JPEG' then
begin
jpeg := TJPEGImage.Create;
try
jpeg.Assign(bit);
jpeg.Compress;
jpeg.SaveToFile(path + PageNr.Text + '.JPG');
Image1.Picture.Assign(jpeg);
finally
jpeg.Free;
end;
end else
begin
Image1.Picture.Assign(bit);
bit.SaveToFile(path + PageNr.Text + '.BMP');
end;
finally
bit.Free;
end;
end
else
begin
Image1.Picture.Assign(meta);
meta.SaveToFile(path + PageNr.Text + '.EMF');
end;
finally
meta.Free;
end;
finally
pdf.Parent := nil;
pdf.Free;
end;
end;
Alles anzeigen
In this code we first retrieve a metafile from the PDF viewer and then render that metafile on a bitmap. This bitmap can then be assigned to a TJPEGImage and finally to a TImage.Picture.
The complete project is available here:
https://www.wpcubed.com/ftp/ex/WPViewPDF_BMP.zip
WPForm uses cm or inch natively. When you change the property FD.Units this affects the way the objects are handled. This system avoids possible rounding errors.
The values displayed are the RulerUnits which can be either of both and don't affect the handling.
I think if I sent Units to wpfInch it will work fine.
Julian