Hi
I installed the printer delivery sample.When i tried to set up
the data driven subscription with delivery mode as printing to a
specific printer.I am getting error.
Done: 2 processed of 2 total; 2 errors.
When i set it as an email.Its working.I am getting email.I could
successfully set up the printer.I did not get any error.In the log
files i dont see any explanation.Is there any setup we have to tell
for printer delivery also log the information.
Thanks
vkvWhen you say you "successfully set up the printer", under which identity did
you set it up? Under what identity is the subscription job running?
Or do you just mean you "successfully told the Reporting Services
configuration about it in its XML file"? In which case, read my first
paragraph again <g>.
>>.Is there any setup we have to tell
>> for printer delivery also log the information.
Are you seeing anything in the log related to this extension at all (in case
you are looking in the wrong log)?
I looked briefly at the code and it looks like it logs all the time.
>L<
"vamsi" <vamsii@.gmail.com> wrote in message
news:1176861152.048216.29700@.b58g2000hsg.googlegroups.com...
> Hi
> I installed the printer delivery sample.When i tried to set up
> the data driven subscription with delivery mode as printing to a
> specific printer.I am getting error.
> Done: 2 processed of 2 total; 2 errors.
> When i set it as an email.Its working.I am getting email.I could
> successfully set up the printer.I did not get any error.In the log
> files i dont see any explanation.Is there any setup we have to tell
> for printer delivery also log the information.
> Thanks
> vkv
>|||Hi
I did set up the subscription under my username identity.I am
having admin permissions on the report server.It did not generate the
log immediately.It generated after 6 hours.I just saw the log file it
said
Notification f57f14c4-32fa-47eb-84f3-3e75e6aa175e completed.
Success: False, Status: Error: Error writing to log file: Access to
the path 'C:\WINDOWS\system32\PrinterDeliveryLog.txt' is denied.,
DeliveryExtension: Printer Delivery Sample, Report:
I created a text document with this name.The subscription ran
successfully and i am getting 0 errors.I checked it did not print the
report.I saw in the PrinterDeliveryLog in system32,i got this message
04/18/2007 08:54:02
Number of pages: 1046
The printer \\SYSTEMS\PRN295_3 is not currently installed on the
server.: at
Microsoft.Samples.ReportingServices.PrinterDelivery.PrinterDeliveryProvider.PrintReport(Notification
notification, SubscriptionData data)
"SYSTEMS" is the server name of all the printers.PRN295_3 is the
printer name.It is installed on the report server.I added this printer
to the server personally.Anything i have to do regarding installing
the printer.
Thanks
vkv|||It doesn't matter that you have admin permissions on the report server...
Your report subscription job is not running under your identity, probably,
and the printer, while installed on the server, is not accessible to the
identity under which that job is running.
The first thing I would do is check to see who has rights to print to that
printer.
This is a common problem with code running in web server apps FWIW... it's
not something I know about specifically to do with Reporting Services, but
it is a common problem for code running under a service account. Check the
account and check if it has rights to print to that (or any!) printer.
>L<
"vamsi" <vamsii@.gmail.com> wrote in message
news:1176913746.971631.47520@.e65g2000hsc.googlegroups.com...
> Hi
> I did set up the subscription under my username identity.I am
> having admin permissions on the report server.It did not generate the
> log immediately.It generated after 6 hours.I just saw the log file it
> said
> Notification f57f14c4-32fa-47eb-84f3-3e75e6aa175e completed.
> Success: False, Status: Error: Error writing to log file: Access to
> the path 'C:\WINDOWS\system32\PrinterDeliveryLog.txt' is denied.,
> DeliveryExtension: Printer Delivery Sample, Report:
> I created a text document with this name.The subscription ran
> successfully and i am getting 0 errors.I checked it did not print the
> report.I saw in the PrinterDeliveryLog in system32,i got this message
> 04/18/2007 08:54:02
> Number of pages: 1046
> The printer \\SYSTEMS\PRN295_3 is not currently installed on the
> server.: at
> Microsoft.Samples.ReportingServices.PrinterDelivery.PrinterDeliveryProvider.PrintReport(Notification
> notification, SubscriptionData data)
> "SYSTEMS" is the server name of all the printers.PRN295_3 is the
> printer name.It is installed on the report server.I added this printer
> to the server personally.Anything i have to do regarding installing
> the printer.
> Thanks
> vkv
>|||I commented out this part of the code
if (!IsValidPrinter(data.Printer))
throw new Exception("The printer " + data.Printer + " is not currently
installed on the server.");
in PrinterDeliveryProvider.cs and its working for now.I have to check
whether i will get any other problem.It always prints in 8.5 * 11 page
irrespective of the settings we give while subscribing.I have to check
the PrinterDeliveryProvider code.
Thanks
vkv|||Thanks for letting me know... but ...
Take a look at the IsValidPrinter function. It checks
PrinterSettings.InstalledPrinters.
*** THE REASON WHY *** this code is failing to find printers is almost
definitely what I said before... I know it says "InstalledPrinters" but the
identity querying for printers has to have printing permission or it's not
going to "see" the installed printers in the list...
Now take a look at the ValidateUserData stuff -- I think it will show you
why the height and width don't change.
>L<
"vamsi" <vamsii@.gmail.com> wrote in message
news:1177005379.609924.169550@.y80g2000hsf.googlegroups.com...
>I commented out this part of the code
> if (!IsValidPrinter(data.Printer))
> throw new Exception("The printer " + data.Printer + " is not currently
> installed on the server.");
> in PrinterDeliveryProvider.cs and its working for now.I have to check
> whether i will get any other problem.It always prints in 8.5 * 11 page
> irrespective of the settings we give while subscribing.I have to check
> the PrinterDeliveryProvider code.
> Thanks
> vkv
>|||I changed the code in PrinterDeliveryProvider for the printer
settings.Now its printing correctly but its not settings the font size
of the report.Its taking its deafult size.I have to search for that
again.Please let me know if you cam eacross this issue.
Thanks
vkv|||I don't quite understand what you mean. As far as I can see there is no
need for the extension code to set a font size. It is not printing text.
It is printing a page image which is handed to it as a metafile.
deviceInfo = String.Format(
System.Globalization.CultureInfo.InvariantCulture,
@."<DeviceInfo><OutputFormat>{0}</OutputFormat><PageHeight>{1}</PageHeight><PageWidth>{2}</PageWidth></DeviceInfo>",
"emf", pageHeight, pageWidth);
// Render report
m_files = notification.Report.Render("IMAGE", deviceInfo);
The font information all comes from the report as rendered by engine code --
the extension isn't sitting around figuring out line height, etc .
The extension only "sees" an image which it proceeds to deliver to the
printer. Why would it pay attention to the printer settings for font
information? Maybe I'm misunderstanding your question...
>L<
"vamsi" <vamsii@.gmail.com> wrote in message
news:1177021179.164488.167590@.q75g2000hsh.googlegroups.com...
>I changed the code in PrinterDeliveryProvider for the printer
> settings.Now its printing correctly but its not settings the font size
> of the report.Its taking its deafult size.I have to search for that
> again.Please let me know if you cam eacross this issue.
> Thanks
> vkv
>|||I thought the same,But it might not happening with my case.When i
print the report from the reportmanager directly i see the font that i
set.When a sheet is printed from printer example font is different so
content is not complete.
This was the reason behind trying to adjust the font size.
Thanks
vkv|||When you print from the report manager, where are you setting the font?
Are you talking about something in the printer setup or something in the
report?
>L<
"vamsi" <vamsii@.gmail.com> wrote in message
news:1177088551.822758.189490@.y80g2000hsf.googlegroups.com...
>I thought the same,But it might not happening with my case.When i
> print the report from the reportmanager directly i see the font that i
> set.When a sheet is printed from printer example font is different so
> content is not complete.
> This was the reason behind trying to adjust the font size.
> Thanks
> vkv
>|||I am not doing anything.i saw other post.that user also complaining
about the image that is rendering to the report.I dont know wat to do
and how to approach|||>>I am not doing anything.
You said:
>>When i print the report from the reportmanager directly i see the font
>>that i set.
So I asked: Where did you set the font? In the report or the printer
setup?
>>i saw other post.that user also complaining about the image that is
>>rendering to the report
I'm not sure which other post you're referring to, but if it's the "printer
delivery sample" thread, it only confirms what I already told you:
This sample extension is printing from an EMF that they get from the engine,
not rendering text. In no way would the sample code, printing an image, be
handling fonts if it is printing a page image. However, the sample code is
not necessarily sizing the image properly, which might look like a font size
issue.
Look: "sizing the image properly" is a non-trivial task. The sample code
has some code stubbed in to decide whether the printer you want to use can
handle the size of the page that the report has been set to, IOW whether
that page size is *valid* on the printer you want. You have commented out
that code right now, I know. But that validation *has* to be done, and is a
small part of the non-trivial task.
The extension code cannot repaginate. It has to decide what to do with the
rendered pages, which were rendered with a certain page size and -- more
significantly -- a certain height to width ratio.
>>I dont know wat to do and how to approach
To handle this task properly:
We know that the report page is already rendered, with a certain height to
width ratio, by the time the extension gets ahold of it. Now the extension
has to decide how to handle any *difference* between the original aspect
ratio and page size and what is available in the user's specified printer
setup.
There are several options the extension has in this situation, and IMHO it
actually should let the user decide which is the best one to use before
proceeding:
* -- scale the EMF and stretch to exactly fit the available page size and
its aspect ratio, even if it might be inappropriate for the current page
aspect ratio as set by the user's chosen printer
* -- scale the EMF but keep the original aspect ratio, fixing the larger of
the two original dimensions to fit the available space and leaving some
white space on the smaller one
* -- scale the EMF but keep the original aspect ratio, fixing the smaller of
the two original dimensions to fit the available space and clipping off
whatever part of the larger one doesn't fit
* -- don't scale the EMF at all -- meaning sometimes you'll have extra
space, more often the page will get clipped in one or both dimensions, but
the aspect ratio and the original intent of the page, as designed in the
report layout, is preserved with fidelity.
Once you have gone this far down the path, and allowed the user a chance to
decide how to handle the current report, you can then add a bunch of other
possibilities, including printing multiple page images per paper page. (I'm
sure you've seen this option in printer driver options, right? Printing two
pages per page, or four pages per page, or whatever? This is how it works.
You have to do the math a little differently than one page per page, but
it's the same basic problem.)
I haven't actually looked to see which decision about scaling the extension
makes. I don't know if there is any dynamic intelligence in the sample code
to handle best-case by comparing the user page size and the original page
size or if it always makes the same decision.
My point here: to approach the problem properly, think about the sizing and
stretching cases above, and how they might play out in your situation. Look
at the sample code to see how it sends the image to the printer.
When you do, you may find (as I believe) that what is going on has NOTHING
to do with "font size" and EVERYTHING to do with image scaling.
If I'm wrong, and it really *does* have to do with font size, then one has
to ask: where did you set the font size that you say the report manager is
respecting but the extension is not?
>L<
"vamsi" <vamsii@.gmail.com> wrote in message
news:1177105049.732348.209160@.b58g2000hsg.googlegroups.com...
>I am not doing anything.i saw other post.that user also complaining
> about the image that is rendering to the report.I dont know wat to do
> and how to approach
>|||I did send email to your personal account of scanned printouts from
report manager and also the printer delivery print out.I am still
trying to scale the EMF.
Thanks
vkv|||Well, I guess I'm glad you told me because it went right in my spam...
... please don't do this again (anybody) unless I ask you to ...
Since you did it this time: It seems pretty clear from the two PDFs that you
sent that what I'm saying is correct: It is an image scaling problem, not a
font size problem.
I know that you don't want an 8.5 x 11 page. But your PDF from the report
manager *is* 8.5 x 11. (look at the properties) I am not sure what the
original report is designed to be but when you scanned the printout and sent
it to a PDF, somewhere along the line it scaled it to 8.5 x11. Do you
understand what I am saying? Somewhere along the line somebody used an
algorithm similar to what I'm saying you have to do.
But the printer extension sample code doesn't do this same thing. You would
have to do it in an adaptation of that code.
In my last message I told you pretty much what decisions have to be made to
scale an image properly. I can't make the choice for you about which case
or which algorithm fits your needs. Even if you wanted to limit it to one
simple case, that case depends on the relationship of the original page size
to the page size you are looking for.
If I were going to write this production-grade/generically, I would try to
cover at least the 4 cases I described to you, and then allow the user some
scaling options, asking which case they wanted for this report. It's not
something you solve one way for every set of page size ratios.
And I don't think that my existing code would help you very much. It's not
.NET code.
But here is pseudocode to show you how you work out the basic problem:
I suspect the overload for doing the drawing is this one:
public void EnumerateMetafile (
Metafile metafile,
Rectangle destRect,
EnumerateMetafileProc callback
)
... IOW, you have to tell the metafile image where it should go, what space
to fill, even if it is going to get stretched or shrunk. (This is pretty
much what IE and Adobe Reader etc do when they offer a "shrink to fit"
option for printing.)
In the simplest case, if you just want to fill the new page size and you
don't care of the new aspect ratio matches the old one, you just set that
destRec to the size of the user-designated (subscription) page size.
(I will skip the part where you interrogate the current printer to find out
what its actual printable page size is like since most printers don't print
all the way to the boundaries of the paper... Sigh. That part probably
applies to all cases.)
IAC, just setting that rectangle to the new page size is not the only or
best way to do it if you want to preserve the aspect ratio of the original
page.
This is something like showing a widescreen film on 4.3 TV. The one thing
you generally *don't* want to do is fill both dimensions and show the
picture stretched to an incorrect aspect ratio, because it looks silly,
everything is out of proportion. OK?
So, how should the film be shown? You have to decide whether you want to fit
the width and have some extra space at the top and/or bottom, or fit the
height and cut off some on each side, etc. Same goes for a widescreen TV
and a "regular" TV show that is broadcase in 4.3. There are several
possible cases, all of which are relevant here. You have no control: the
original page might be landscape while the new page is portrait or the other
way around, you're looking for the best fit in each situation.
So, how you do it: you can figure out the difference between page sizes
(rendered and subscription page) and the approach you will take when you get
ready to print the first page.
You should see a line that looks like this in the code:
// Load the metafile image for this page
m_metafile = new Metafile(m_currentPageStream);
A metafile image is being loaded for each page. On the first page, when you
start the job, you can interrogate this image for its size.
m_originalWidth = m_metafile.Width
m_originalHeight = m_metafile.Height
... with me so far?
Now you have to do the math. You can compare that image's aspect ratio with
the one your user has provided for the page size they want, in the settings
array (SubscriptionData.PAGEHEIGHT/SubscriptionData.PAGEWIDTH), and make any
necessary adjustments in the destRect.
You could start by trying to fill the new Width completely. You know the
original Width and its relationship to the new subscription page width. The
new height has to be the same percentage of the original
m_metafile.Height -- whether bigger or smaller -- as the new width is of the
original Width. That's how the aspect ratio stays correct.
So now you have a possible new height for your destRect. Is that new height
bigger than the available height of the subscription page? Then try it the
other way around: try filling the Height and seeing if you can get the
Width to fit.
(There are ways to decide which to try first, I'm skipping all that. The
result is the same no matter how smart or dumb you make the code.)
If you can't get both dimensions to fit on the page, try cutting down both
dimensions by some percentage (say, 5%) and try again.
I hope you're starting to see what I'm talking about.
See... ** THEY WROTE A SAMPLE **. It's not production-grade. What else
can I say.
>L<
"vamsi" <vamsii@.gmail.com> wrote in message
news:1177117415.975650.74970@.l77g2000hsb.googlegroups.com...
>I did send email to your personal account of scanned printouts from
> report manager and also the printer delivery print out.I am still
> trying to scale the EMF.
> Thanks
> vkv
>|||Thanks for giving really good suggestions from where i have to
start.My fault for sending the email.
I have to make this printer delivery for only this report,so i can
make any changes which fits this report.Thats atleast good part.I dont
have to write generalize code.For this report i am intended to print
8.5 * 11.
As you suggested earlier on this point
* -- scale the EMF and stretch to exactly fit the available page size
and
its aspect ratio, even if it might be inappropriate for the current
page
aspect ratio as set by the user's chosen printer
-- Scale emf means dealing with resolution ' If it is meant
resolution Metafile resolution properties are read only.
And on the Suggestion
You should see a line that looks like this in the code:
// Load the metafile image for this page
m_metafile = new Metafile(m_currentPageStream);
A metafile image is being loaded for each page. On the first page,
when you
start the job, you can interrogate this image for its size.
m_originalWidth = m_metafile.Width
m_originalHeight = m_metafile.Height
There is no line of code like this,but the kept those lines and found
out that width is 817 and height is 1057.
I changed the dest where it has to print from Point destPoint = new
Point(0, 0); to Point destPoint = new Point(-35, -30); There is
little bit improvement on the both horizontal and vertical positions.
I am thinking the only way to get this right is reduce the
resolution.Am i going in right direction.
You are right that it is only a sample.I should extend to make it
compatible for my purpose.
Thanks for giving replies.
Thanks
vkv|||I changed the function ReportDrawPage and it is working as i wanted.
private void ReportDrawPage(Graphics graphics)
{
if (null == m_currentPageStream || 0 ==m_currentPageStream.Length || null == m_metafile)
return;
lock (this)
{
// Set the metafile delegate.
int width = m_metafile.Width;
int height = m_metafile.Height;
m_delegate = new
Graphics.EnumerateMetafileProc(MetafileCallback);
// Draw in the rectangle
//Point destPoint = new Point(0, 0);
System.Drawing.Rectangle rect = new
System.Drawing.Rectangle(0, 0, width, height);
graphics.EnumerateMetafile(m_metafile, rect,
m_delegate);
// Clean up
m_delegate = null;
}
}
Thanks for your help that you responded all this time.
vkv|||Yup -- that will work for your simple case. I'm glad for you!
The reason I gave you the additional, generic information is to explain why
it is hard to do this, for you and for other people reading. <s>
IOW: I would like to help folks here understand why they didn't "just add
the little bit of extra code to make the sample more robust". The answer is
because it wouldn't be "a little bit of extra code" to do it correctly <g>.
Caveat: I really don't understand why they didn't use the overload of
EnumerateMetafileProc that I suggested and that you have used
successfully -- that *would* have been a "little bit of code" and would have
pointed people in the right direction... following that same little bit of
help from me you did just fine! <s>.
To answer something in your other message -- although resolution of the
*EMF* is readonly, we're not adjusting resolution of the EMF (the source).
We are adjusting the dimensions to which the image is being rendered to the
printer (the target). This might be just another way of saying that we need
to adjust the resolution of the *target* but you don't really need to think
it. I think you now understand this, but I want to make sure everybody
reading does.
Also, yes, there was no line of code like this:
m_originalWidth = m_metafile.Width
m_originalHeight = m_metafile.Height
<<
That was code I was suggesting that you *add* after the line in the code
loading the metafile. You do not need to do it in the non-generic case,
but I was suggesting that if one were writing this generically, one would
take those values when interrogating that first image and save them to
member properties. Then they are available to use in math as required.
There are scenarios in which one has to re-evaluate them again after the
first page (which, again, do not concern you at the moment).
Regards,
>L<
"vamsi" <vamsii@.gmail.com> wrote in message
news:1177369963.637449.95000@.y5g2000hsa.googlegroups.com...
>I changed the function ReportDrawPage and it is working as i wanted.
>
> private void ReportDrawPage(Graphics graphics)
> {
> if (null == m_currentPageStream || 0 ==> m_currentPageStream.Length || null == m_metafile)
> return;
> lock (this)
> {
> // Set the metafile delegate.
> int width = m_metafile.Width;
> int height = m_metafile.Height;
> m_delegate = new
> Graphics.EnumerateMetafileProc(MetafileCallback);
> // Draw in the rectangle
> //Point destPoint = new Point(0, 0);
> System.Drawing.Rectangle rect = new
> System.Drawing.Rectangle(0, 0, width, height);
> graphics.EnumerateMetafile(m_metafile, rect,
> m_delegate);
> // Clean up
> m_delegate = null;
> }
>
> }
>
> Thanks for your help that you responded all this time.
> vkv
>|||On Apr 25, 6:14 am, "Lisa Slater Nicholls" <l...@.spacefold.com> wrote:
> Yup -- that will work for your simple case. I'm glad for you!
> The reason I gave you the additional, generic information is to explain why
> it is hard to do this, for you and for other people reading. <s>
> IOW: I would like to help folks here understand why they didn't "just add
> the little bit of extra code to make the sample more robust". The answer is
> because it wouldn't be "a little bit of extra code" to do it correctly <g>.
> Caveat: I really don't understand why they didn't use the overload of
> EnumerateMetafileProc that I suggested and that you have used
> successfully -- that *would* have been a "little bit of code" and would have
> pointed people in the right direction... following that same little bit of
> help from me you did just fine! <s>.
> To answer something in your other message -- although resolution of the
> *EMF* is readonly, we're not adjusting resolution of theEMF(the source).
> We are adjusting the dimensions to which the image is being rendered to the
> printer (the target). This might be just another way of saying that we need
> to adjust the resolution of the *target* but you don't really need to think
> it. I think you now understand this, but I want to make sure everybody
> reading does.
> Also, yes, there was no line of code like this:
>
> m_originalWidth = m_metafile.Width
> m_originalHeight = m_metafile.Height
> <<
> That was code I was suggesting that you *add* after the line in the code
> loading the metafile. You do not need to do it in the non-generic case,
> but I was suggesting that if one were writing this generically, one would
> take those values when interrogating that first image and save them to
> member properties. Then they are available to use in math as required.
> There are scenarios in which one has to re-evaluate them again after the
> first page (which, again, do not concern you at the moment).
> Regards,
> >L<
> "vamsi" <vam...@.gmail.com> wrote in message
> news:1177369963.637449.95000@.y5g2000hsa.googlegroups.com...
>
> >I changed the function ReportDrawPage and it is working as i wanted.
> > private void ReportDrawPage(Graphics graphics)
> > {
> > if (null == m_currentPageStream || 0 ==> > m_currentPageStream.Length || null == m_metafile)
> > return;
> > lock (this)
> > {
> > // Set the metafile delegate.
> > int width = m_metafile.Width;
> > int height = m_metafile.Height;
> > m_delegate = new
> > Graphics.EnumerateMetafileProc(MetafileCallback);
> > // Draw in the rectangle
> > //Point destPoint = new Point(0, 0);
> > System.Drawing.Rectangle rect = new
> > System.Drawing.Rectangle(0, 0, width, height);
> > graphics.EnumerateMetafile(m_metafile, rect,
> > m_delegate);
> > // Clean up
> > m_delegate = null;
> > }
> > }
> > Thanks for your help that you responded all this time.
> > vkv- Hide quoted text -
> - Show quoted text -
Ha Ha !!!
Wasnt expecting it to be so easy
insted of passing the point pass a rectangle ...
Rectangle destRect = new Rectangle(0, 0, m_metafile.Width ,
m_metafile.Height);
graphics.EnumerateMetafile(m_metafile, destRect, m_delegate);
// the original code in the example is passing a point as aopposed to
the rectangle.
Cheers|||On Apr 21, 5:02 am, vamsi <vam...@.gmail.com> wrote:
> I thought the same,But it might not happening with my case.When i
> print the report from the reportmanager directly i see thefontthat i
> set.When a sheet is printed from printer examplefontis different so
> content is not complete.
> This was the reason behind trying to adjust thefontsize.
> Thanks
> vkv
The Reason for the difference in the font size is because of scaling.
All you need to do is to modify two lines of code.
in the ReportDrawPage method insted of passing a Point object to the
EnumerateMetafile method pass a rectangle as shown below...
private void ReportDrawPage(Graphics graphics)
{
.....
Rectangle destRect = new Rectangle(0, 0, m_metafile.Width ,
m_metafile.Height);
graphics.EnumerateMetafile(m_metafile, destRect, m_delegate);
......
}|||>> // the original code in the example is passing a point as aopposed to
> the rectangle.
Yes, I know. That's why I suggested the overload you used. <g>
I still don't understand why they used the one they did...
>L<
>
<anilrawat@.gmail.com> wrote in message
news:1179713963.079135.68760@.z28g2000prd.googlegroups.com...
> On Apr 25, 6:14 am, "Lisa Slater Nicholls" <l...@.spacefold.com> wrote:
>> Yup -- that will work for your simple case. I'm glad for you!
>> The reason I gave you the additional, generic information is to explain
>> why
>> it is hard to do this, for you and for other people reading. <s>
>> IOW: I would like to help folks here understand why they didn't "just add
>> the little bit of extra code to make the sample more robust". The answer
>> is
>> because it wouldn't be "a little bit of extra code" to do it correctly
>> <g>.
>> Caveat: I really don't understand why they didn't use the overload of
>> EnumerateMetafileProc that I suggested and that you have used
>> successfully -- that *would* have been a "little bit of code" and would
>> have
>> pointed people in the right direction... following that same little bit
>> of
>> help from me you did just fine! <s>.
>> To answer something in your other message -- although resolution of the
>> *EMF* is readonly, we're not adjusting resolution of theEMF(the source).
>> We are adjusting the dimensions to which the image is being rendered to
>> the
>> printer (the target). This might be just another way of saying that we
>> need
>> to adjust the resolution of the *target* but you don't really need to
>> think
>> it. I think you now understand this, but I want to make sure everybody
>> reading does.
>> Also, yes, there was no line of code like this:
>>
>> m_originalWidth = m_metafile.Width
>> m_originalHeight = m_metafile.Height
>> <<
>> That was code I was suggesting that you *add* after the line in the code
>> loading the metafile. You do not need to do it in the non-generic case,
>> but I was suggesting that if one were writing this generically, one
>> would
>> take those values when interrogating that first image and save them to
>> member properties. Then they are available to use in math as required.
>> There are scenarios in which one has to re-evaluate them again after the
>> first page (which, again, do not concern you at the moment).
>> Regards,
>> >L<
>> "vamsi" <vam...@.gmail.com> wrote in message
>> news:1177369963.637449.95000@.y5g2000hsa.googlegroups.com...
>>
>> >I changed the function ReportDrawPage and it is working as i wanted.
>> > private void ReportDrawPage(Graphics graphics)
>> > {
>> > if (null == m_currentPageStream || 0 ==>> > m_currentPageStream.Length || null == m_metafile)
>> > return;
>> > lock (this)
>> > {
>> > // Set the metafile delegate.
>> > int width = m_metafile.Width;
>> > int height = m_metafile.Height;
>> > m_delegate = new
>> > Graphics.EnumerateMetafileProc(MetafileCallback);
>> > // Draw in the rectangle
>> > //Point destPoint = new Point(0, 0);
>> > System.Drawing.Rectangle rect = new
>> > System.Drawing.Rectangle(0, 0, width, height);
>> > graphics.EnumerateMetafile(m_metafile, rect,
>> > m_delegate);
>> > // Clean up
>> > m_delegate = null;
>> > }
>> > }
>> > Thanks for your help that you responded all this time.
>> > vkv- Hide quoted text -
>> - Show quoted text -
>
> Ha Ha !!!
> Wasnt expecting it to be so easy
> insted of passing the point pass a rectangle ...
> Rectangle destRect = new Rectangle(0, 0, m_metafile.Width ,
> m_metafile.Height);
> graphics.EnumerateMetafile(m_metafile, destRect, m_delegate);
> // the original code in the example is passing a point as aopposed to
> the rectangle.
> Cheers
>
No comments:
Post a Comment