PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Jul 11, 2024 10:23 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri May 06, 2011 1:26 pm 
Offline

Joined: Fri May 06, 2011 1:23 pm
Posts: 2
Hi there guys,
im new to PDF Sharp and wanted to ask something:

in VB2010 i used

gfx.DrawString(MYLINE, font1, XBrushes.Black, New XRect(50, 120, page1.Width.Point, page1.Height.Point), XStringFormats.TopLeft)


to draw the Text from "MYLINE"



How can i drwa an image?

I wanted to print the image (image.jpg) on Harddisk D:/

The only samples i found, are for C#, not for VB.NET

Can you help me please?
Thank you and sorry for my bad english ;)


Greetings
Vanessa


Top
 Profile  
Reply with quote  
PostPosted: Sun May 08, 2011 8:27 am 
Offline

Joined: Wed Apr 13, 2011 6:39 pm
Posts: 21
Hi ho,

you have then to translate the smaple code into VB.
In example this could be something from:
Code:
void DrawImage(XGraphics gfx, int number)
{
BeginBox(gfx, number, "DrawImage (original)");
 
XImage image = XImage.FromFile(jpegSamplePath);
 
// Left position in point
double x = (250 - image.PixelWidth * 72 / image.HorizontalResolution) / 2;
gfx.DrawImage(image, x, 0);
 
EndBox(gfx);
}

To:
Code:
Private Sub DrawImage (GFX As XGraphics, Number as Integer)
  Image as XImage = XImage.FromFile(jpegSamplePath)
  Dim x As Double = ((250 - image.PixelWidth * 72 / image.HorizontalResolution) / 2)
  GFX.DrawImage(Image, x, 0)
End Sub


I haven't tested the code but maybe you get the idea what is to do.

HTH
Greetings from germany
Reiner


Top
 Profile  
Reply with quote  
PostPosted: Tue May 17, 2011 6:30 pm 
Offline

Joined: Fri May 06, 2011 1:23 pm
Posts: 2
Hello Reiner,

nice to see other Germans here^^


In German:

So kann ich es besser weklären ;)

Ich erhalte beim einfügen des Codes 2 Fehler:

Fehler 1
Für den Parameter "GFX" von "Public Sub DrawImage(GFX As PdfSharp.Drawing.XGraphics, Number As Integer)" wurde kein Argument angegeben.


Fehler 2
Für den Parameter "Number" von "Public Sub DrawImage(GFX As PdfSharp.Drawing.XGraphics, Number As Integer)" wurde kein Argument angegeben.


Habe den Private Sub eingefüht und an entsprechender Stelle per DrawImage() aufgerufen.

ohne den Aufruf habeich keine Fehlermeldung - aber ich muss den befehl ja irgendwie aufrufen, damit dieser auch ausgeführt wird, oder?

Danke für deine nette Hilfe
Vanessa


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 31 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group