?
Solved

About printing

Posted on 1998-11-10
6
Medium Priority
?
134 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 160 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
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!

 
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

Industry Leaders: 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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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 process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

770 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