|
benjymous wrote: print that to pdf.
Print to pdf by making the application to choose the pdf995's ( or any other pdf printer) printer silently? Is that right? If that is so, how can I silently choose the printer and execute the print command?
Fortitudine Vincimus!
|
|
|
|
|
Just write your own pdf exporter. It takes a bit of time but it frees you from other peoples code from that day forward. It took me about 6 months to write a GDI/GDI+ compatible, xml parsing PDF exporter that I can now use in all my apps. Well worth the time and effort.
PDF Reference Fifth Edition[^]
|
|
|
|
|
Hello,
I am trying to write simple text of different colors to pdf. So far I have been able to write a string of grey color to pdf. But I need to write other lines too with blue color. Please can you guide me on how to do this?
If we use BT for start of text object and ET for end, a string can be written of a particular font and color.
Now if I have to write another string of some other color, do I have to use another set of BT and ET? I tried it this way but it is not working. Either I have missed the topic in the pdf manual or am not understanding something.
Any help will be highly appreciated.
Thanks.
Fortitudine Vincimus!
|
|
|
|
|
Tara14 wrote: do I have to use another set of BT and ET?
That's how I do it.
"BT /F1 30 Tf 100 -100 Td (Test) Tj ET\n"
/* NOTE: I make my Y axis match my GDI/GDI+ mapping mode so you may find things a little different in terms of the Y axis in your environment. I use MM_ISOTROPIC and I make sure the Y goes downward as it increments so I set all my PDF media boxes accordingly. PDF default rect is left/bottom to right/top which did not make it easy to reuse my GDI/GDI+ action data unless I flipped it around */
Also, PDF will keep track of it's graphics state. This means you only need to change the stroke color, stroke width, fill color etc... when they change. You can choose to explicitly set it on each drawing command but you can save lots of file space if you only change it when you need to.
Does your output format resemble the above (ignoring the values of course)?
|
|
|
|
|
Thank you for your reply.
bob16972 wrote: Does your output format resemble the above (ignoring the values of course)?
Yes. The format is exacly like this. In palce of (Text) I enter in the string that should be written to pdf. Lines are seperated by T*(Text)Tj.
bob16972 wrote: "BT /F1 30 Tf 100 -100 Td (Test) Tj ET\n"
I am a bit confused here. /F is the font type, right?
Whatever font is being used must be described earlier in the font dictionary, right?
Is <code>(Text)</code> the entire text that is being written to pdf? Suppose the text is something from a doc file.
If yes, how does the pdf know which part of the text uses which font and which color?
You mentiond that "Also, PDF will keep track of its graphics state. This means you only need to change the...."
I do not understand this. Please can you elaborate a little.
Thank you once again for your help.
Fortitudine Vincimus!
|
|
|
|
|
Tara14 wrote: I am a bit confused here. /F is the font type, right?
That is the resource name. A good example of this is on page 270 (292 of 1236) of the PDF Specification 1.6
Tara14 wrote: Whatever font is being used must be described earlier in the font dictionary, right?
PDF is written to be read somewhat backward but I believe you will see many different ways of laying the file out. The rules are very confusing and complex in my opinion. My implementation ends up declaring the font descriptor objects toward the front but the resource names get associated with the font descriptors in my Pages object which happens to be toward the end of my file slightly before the Cross Reference and the Trailer. However, you can lay your file out in any way that does not violate the rules in the specification so it would be wrong for me to say yes or no to this question.
Tara14 wrote: Is (Text) the entire text that is being written to pdf?
Yes (Except for the parenthesis of course). Don't forget to apply PDF escape sequences as described on page 30 (52 of 1236) of PDF Specification 1.6 to prevent string literal characters from conflicting with the PDF file.
Tara14 wrote: Suppose the text is something from a doc file.
If yes, how does the pdf know which part of the text uses which font and which color?
It is up to you to tell PDF what to render and how to render it. If you don't know how to parse the doc file, you will be unable to tell PDF what to draw and where and with what color etc...
My documents are described in XML so I parse the information that describes the action of drawing each graphics primitive (lines, bezier curves, rectangles, and Text) and then I translate it to a GDI/GDI+ graphics primitive command if drawing to the screen or printing or to PDF postscript that corresponds to the equivalent PDF graphics primitive command if exporting to PDF. If you do not have the information necessary to parse the doc file, you will have to resort to a print driver strategy like some vendors but I'm afraid I have no experience there and would be of little help.
Tara14 wrote: You mentiond that "Also, PDF will keep track of its graphics state. This means you only need to change the...."
I do not understand this. Please can you elaborate a little.
For example...
If you set the Stroke color to red, all subsequent graphics commands will use red for the stroke color until the graphics state goes out of scope (as described in the specification) or until the Stroke color is explicitly set/changed by you. If the Fill color is set to blue all subsequent graphics commands that use a fill color will use blue until the graphics state goes out of scope or until the fill color is explicitely set/changed by you. etc...
I hope that helps
|
|
|
|
|
Thanks a lot for your patience. I am begining to understand quite a lot now.
This is a bit complex and confusing, but I guess the more I read the manual, the better I will understand.
Thank you once again.
Fortitudine Vincimus!
|
|
|
|
|
Hello,
Is there anyway I can open the pdf from the application one it is created? Shellexecute is not working.
I searched codeproject and found "A simple wrapper to control Acrobat Reader from your application, By seasidetech." but it does not work if adobe is not already open. And I am not able to understand why.
Please help.
Thanks.
Fortitudine Vincimus!
|
|
|
|
|
I'm not sure what you mean when you say ShellExecute is not working. Once I export my .pdf to some path, I call ShellExecute to display it. This is of course assuming Adobe Reader is installed on the machine using the "open" verb
// Note: pApp obtained via AfxGetApp()
ShellExecute(pApp->m_pMainWnd->GetSafeHwnd(),"open",sPath,NULL,NULL,SW_SHOWMAXIMIZED);
|
|
|
|
|
Is there a way know at what time the system has been shutted down. When the system has been started.
Thank You.
KIRAN PINJARLA
|
|
|
|
|
kiran.pinjarla wrote: When the system has been started.
One way is via the Win32_OperatingSystem WMI class. GetTickCount() is only good for about 49 days.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Start time
DWORD GetTickCount(VOID); return the time in mili seconds since the system has been started from that you can calculate the time when it has been started and how long
shut down
?
G_S
|
|
|
|
|
kiran.pinjarla wrote: s there a way know at what time the system has been shutted down. When the system has been started.
write a Winlogon notification package!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi,
In a property page i will enter some field names.using this names I want to create a table in the database.
Can u Plz help.
thanks in advance.
|
|
|
|
|
What is your problem exactely ? What have you already done ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
So what is your problem.
Working with Property Pages or Filing the entries in the database
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
tejaswini.g wrote: I want to create a table in the database
But in where ?
|
|
|
|
|
You can use CDatabase::ExecuteSQL("CREATE TABLE MyTable (...)") for this. Just
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
In my application I have created a propertypage.In that property page I have displayed three edit boxes.
For example in that edit boxes the user will enter name,sex,age.
Taking those three values as column names I have to create a table in the database.
while creating my project I have chosen Database view with file support.
Can u plz help me.
Thanks in advance.
|
|
|
|
|
Hi gurus,
I have a problem here. I have forgotten how to pass a 2D array in a function . Normally an int** should do the deal, but no
Here is a sample code:
<br />
#include <stdio.h><br />
<br />
int g_tab[16][4]=<br />
{<br />
{ 0x03e0, 0x14a5, 0x0000, 0x0000, },<br />
{ 0x7fff, 0x6739, 0x4e73, 0x18c6, },<br />
{ 0x6460, 0x6431, 0x0821, 0x7bfe, },<br />
{ 0x0000, 0x001f, 0x03e0, 0x7c00, },<br />
{ 0x7fff, 0x7fff, 0x4631, 0x2529, },<br />
{ 0x7fff, 0x4a52, 0x2d6b, 0x0000, },<br />
{ 0x01e0, 0x0260, 0x0340, 0x0140, },<br />
{ 0x7bff, 0x1ce8, 0x5294, 0x7fff, },<br />
<br />
{ 0x67ff, 0x14a5, 0x56b5, 0x7fff, },<br />
{ 0x7fff, 0x6739, 0x4e73, 0x18c6, },<br />
{ 0x6460, 0x4631, 0x0821, 0x7bfe, },<br />
{ 0x0000, 0x0000, 0x0000, 0x0000, },<br />
{ 0x0000, 0x029d, 0x025b, 0x0195, },<br />
{ 0x0000, 0x0131, 0x00cf, 0x0047, },<br />
{ 0x0000, 0x01b6, 0x02df, 0x03e0, },<br />
{ 0x68ba, 0x6660, 0x7c00, 0x3460, },<br />
};<br />
<br />
void Apply(int** tab)<br />
{<br />
int y=0, x=0;<br />
<br />
for (y=0; y<16; y++)<br />
{<br />
for (x=0; x<4; x++)<br />
printf("%d ", tab[y][x]);<br />
<br />
printf("\n");<br />
}<br />
}<br />
<br />
int main()<br />
{<br />
Apply(g_tab);<br />
<br />
return 0;<br />
}<br />
I don't see what's wrong with the code, but it crashes when calling tab[y][x] .
Can anybody help me and tell me what's wrong please?
Best regards.
Fred.
There is no spoon.
|
|
|
|
|
|
Hi,
I still get a crash with 3 '*'
There is no spoon.
|
|
|
|
|
you need to access array like this,
for (y=0; y<16; y++)
{
for (x=0; x<4; x++)
printf("%d ", tab[x]);
tab++;
printf("\n");
}
|
|
|
|
|
void Apply(int* tab)
{
int y=0, x=0;
for (y=0; y<16; y++)
{
for (x=0; x<4; x++)
printf("%d ", tab+y+x*y);
printf("\n");
}
}
In main:
Apply((int*)g_tab);
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
yes, it works that way
but for readability, I wished to used the tab[..][..] notation...
There is no spoon.
|
|
|
|
|