Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How To Write Data of DBF file in Text File
Message
De
12/03/2013 15:45:21
 
 
À
12/03/2013 09:35:17
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01567961
Message ID:
01568112
Vues:
33
Actually, I am tring to write a VFP code that Could merge two or more pages of post Script files. I have lots of White blank space on each page of my PS file, so there is lot of paper wastage.

My idea is , I am appending text inside a PS file to a VFP table and will re-process it finally again to a PS file.

The 'U1' command Shows/Display the PS page and '0 -72 6 mul translate' is used to merge the page.

Hence, if page Number 2 &3 are to be merged, U1 at the end of Page Number 2 shall be removed(in VFP table) and '0 -72 6 mul translate' shall be inserted. This will merge page 2 and 3 in one page. Same action is required for further pages.

My code, Need & Problem.

I dont want to disturb Page Number 1, want to keep it as it is.

In the code below mentioned, I have calculated the occoupied space and unoccoupied space of post script Data/image for Each Page.
So, if the Unoccoupied space or free/blank space at page Number 2 is greater than Occoupied space at page Number 3, Page 3 will Merge in 2.

MY PROBLEM
If the Unocoupied space or free/blank space at page Number 2 is greater than Occoupied space at page Number 3, Page 3 will Merge in 2 , however if there is still space left in page 2 so that it can further accommodate page 4,5,6 etc, this I am Not able to Do. Some Little Bit alteration is requied , but I am not able to Do it.

Some DO While...Enddo loop may work, but I am not able to do it.

Kinldy Help, I am trying to do this since last 2-3 weeks.

Here is the very small PS file , if you need to download

https://www.dropbox.com/s/6x5an3dyg8syvmx/1021337392.ps



MY code
Clear
SET DELETED ON

lcStr = filetostr('1021337392.ps')
lnPOS = At("%%Pages:",lcStr)
lcPageCount = alltrim(substr(lcStr, lnPOS, 12))
lnPageCount = VAL(STRTRAN(lcPageCount,'%%Pages:',''))

IF lnPageCount>2
DIMENSION occoupiedrange(lnPageCount)
DIMENSION unoccoupiedrange(lnPageCount)

Local lcFile, lcText
m.lcFile = [1021337392.ps]
Create Cursor Dummy (PS c(254), pos i,pageno n(2))
Append From (m.lcFile) Sdf

SCAN
IF Getwordnum(PS, Getwordcount(PS)) = [x] .OR. ;
Getwordnum(PS, Getwordcount(PS)) = [y] .OR. ;
Getwordnum(PS, Getwordcount(PS)) = [w]
m.lcText = Getwordnum(PS, Getwordcount(PS) - 1) && The second last word
IF Len(Chrtran(m.lcText, [1234567890], [])) = 0 && lcText contains only digits
Replace pos With Val(m.lcText)
Endif
ENDIF
ENDSCAN
   
FOR I= 1 TO lnPageCount
CURTEXT='%%Page: '+ALLTRIM(STR(I))+' '+ALLTRIM(STR(I))
NeXTTEXT='%%Page: '+ALLTRIM(STR(I+1))+" "+ALLTRIM(STR(I+1))
DELETE FROM dummy WHERE ps like "%(of%" AND pageno>1
DELETE FROM dummy WHERE ps like "%(Page%" AND pageno>1

LOCATE FOR ALLTRIM(PS)=curtext
SCAN WHILE ALLTRIM(ps)<>nexttext OR EOF()=.T.
REPLACE pageno WITH I
ENDSCAN
SELECT MIN(Pos) FROM Dummy WHERE Pageno=I AND Pos>30 INTO ARRAY X
SELECT MAX(Pos) FROM Dummy WHERE Pageno=I INTO ARRAY Y
STORE Y-X+1 TO Occoupiedrange(I)
STORE (x-30) TO unoccoupiedrange(I)
ENDF                                                                                                                                                                                                                                                  


FOR I=2 TO (lnPageCount-1)
IF unoccoupiedrange(I)> occoupiedrange(I+1)
NeXTTEXT='%%Page: '+ALLTRIM(STR(I+1))+" "+ALLTRIM(STR(I+1))
LOCATE FOR ps=NeXTTEXT
Skip-1 
Replace ps WITH NeXTTEXT
SKIP
Replace ps WITH '0 -72 6 mul translate'
I=I+1
ENDIF
ENDFOR
ENDIF

SELECT Dummy
set textmerge On
SET TEXTMERGE TO myfile.ps noshow 
scan
\\ << tRIM(pS) >>
\
endscan
set textmerge To
set textmerge off
>>Thanks Madam, It is working Fine Now.
>>
>>Another small Problem i am not able to solve it since last 2-3 weeks, could you help on it please.
>>I am trying to use the empty white blank space of Post script file for this I have written some code.
>>
>> Kinldy see the last Para of the following code, Page break command for PS is Given in Last para, My problem is that using the Page break command I am able to merge two pages if unoccoupiedrange(I)> occoupiedrange(I+1), however if there is still more space left after one page is accomodated i.e I mean to say that IF unoccoupiedrange(I)> occoupiedrange(I+1)+occoupiedrange(I+2)...and so.
>>
>>How to write code for it.
>>
>>Some alteration in last Para is required.
>
>I'm sorry. I don't understand your new question. Can you show a little bit of an example.
>
>Tamar
Harsh
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform