Solved

About printing

Posted on 1998-11-10
6
131 Views
Last Modified: 2010-04-30
Hi

Note: Here are two questions, you are wellcome to answer any one or both. Depends on how difficult the questions are (I don't know at the moment), the points will be increased :-)

1. Without using Crystal Report or other application, how to write Print-Preview for simple text (may includes different size fonts) and small bmp?

2. Before exit a VB application, I would like to create a PostScript file and put some stuff into the file. Can you tell me how to send the file to the printer by VB code?
0
Comment
Question by:username1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 3

Accepted Solution

by:
vikiing earned 80 total points
ID: 1444115
Answer for 2):

Open  "post-script.file" for binary as #1
Siz&=Lof(1)
Do
   Portion& = Siz& : If Portion& > 1024 then Portion&=1024
   If Portion& < 1 then Exit do
   Get$ #1,Portion&,Buffer$
   Printer.Print  Buffer$;
   Siz&=Siz&-Portion&
loop
Printer.Enddoc
Close #1

0
 

Author Comment

by:username1
ID: 1444116
Hi vikiing

Thank you for answer question 2.

Can you tell me:
1) Why we need 1024, not whole file in one go?
2) I remember we can send a PostScript file to the printer by
      c:\copy thefile.ps lpt1
   Is this possible doing that from VB?

Cheers.
0
 

Author Comment

by:username1
ID: 1444117
Adjusted points to 80
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 3

Expert Comment

by:vikiing
ID: 1444118
I see I didn't check the "e-mail notification".

You can read/write the file in a single chunk, provided file size be less than 64 Kb (the maximum length any string variable can have). But you must not forget that string space (the total area reserved for string handling) has its own restrictions also; your program will surely use another string variables, so you must be conservative about their use.

¿Why 1024 and not 1000?; simply 'cause 1024 is a multiple of 512, the size of a single disk sector. Using that size you can optimize a bit the time required to read data, by reading whole sectors instead fractions of it.


0
 

Author Comment

by:username1
ID: 1444119
To Vikiing:

Thank you.

I have found some mistakes you did :-)

> Portion& = Siz& : If Portion& > 1024 then Portion&=1024
>      If Portion& < 1 then Exit do
>      Get$ #1,Portion&,Buffer$

The second parameter (Portion&, in the above code) of Get$ is the position where getting starts. It shoul not be the size.....

Hope you can read my comment.
0
 
LVL 3

Expert Comment

by:vikiing
ID: 1444120
Unfortunately, I suposed GET$ worked the same way as in Turbo Basic, where the second parameter specifies the amount of bytes to be read.

Sorry for the mistake... :(
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Recommendation vb6 to vb.net or others 14 240
Problem to line 23 79
Dinamic report to Crosstab query 9 59
Userform to show a range in excel. 3 33
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question