Objects not printed at proper location

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

Objects not printed at proper location

Postby nc1264 » Tue Jun 21, 2011 7:54 am

I have created an application that generates labels for our chemical products for the US market. On this label a special item needs be be printed: a hashed border.
Although I have created a routine to create this border every once in a while I have a strange incident.

The border contains of the following:
- corners (upper left, lower left, upper right, lower right)
- vertical lines
- horizontal lines

The problem I run into is that every once in while both the horizontal and vertical lines are repositioned by 2 cm's. The vertical lines move 2cm's to the right and the horizontal lines move 2cm's down.
I have adjusted the routine several times to change the sequence of things (lines first, corners next, etc) but until now I have not been able to solve the puzzle why this is happening at all. As the off-set is always 2cm I have the impression that a 'default' value (of something) is interfering with my code.
What is even more strange is that this repositioning ONLY happens for the hashed border lines...the corners do not show this and neither do any of the other objects that are placed on the label.

Although this behavior seems random there seems to be pattern in it. If I generate the same label multiple times than the first one is usually wrong...but the second one is always right.
Does anyone have a thought on why this might be happening?

PS I'm using VFP8 for the source and VPE3.5Enterprise Edition to generate the document.

Code: Select all
print_hash('H', 60, 30, 90, tmpLabelLines.lnEndY) && Horizontal, lnEndY
print_hash('V', 60, 30, 90, tmpLabelLines.lnEndY) && Vertical


PROCEDURE print_hash(vDirection as Character, nHashWidth as integer, nHashHeight as integer, nDistance as integer, nHashTop as Integer)
PRIVATE oPolygon
PRIVATE nHashCounter = 0
oPolygon = ''
nHashCounter = 0

poform.lovpe.tovpe.olevpe.setdefoutrect(-200, -200, tmpLabelDef.LDwidth, tmpLabelDef.LDlength)
poform.lovpe.tovpe.olevpe.setoutrect(-200, -200, tmpLabelDef.LDwidth, tmpLabelDef.LDlength)

IF vDirection = 'H'
   FOR nTeller = tmpLabelLines.lnBeginX TO tmpLabelLines.lnEndX  STEP nDistance
      xTeller = nTeller
      poform.lovpe.tovpe.olevpe.BkgMode = VBKG_SOLID
      poform.lovpe.tovpe.olevpe.BkgColor = color_black
      poform.lovpe.tovpe.olevpe.pensize  = 1

      oPolygon=poform.lovpe.tovpe.olevpe.Polygon(4)
      poform.lovpe.tovpe.olevpe.AddPolygonPoint(oPolygon, -200 + tmpLabelLines.lnBeginX + nHashCounter * nDistance                                       , nHashTop - nHashHeight + labellines.lnBeginY)
      poform.lovpe.tovpe.olevpe.AddPolygonPoint(oPolygon, -200 + tmpLabelLines.lnBeginX + nHashCounter * nDistance + nHashWidth                       , nHashTop - nHashHeight + labellines.lnBeginY)
      poform.lovpe.tovpe.olevpe.AddPolygonPoint(oPolygon, -200 + tmpLabelLines.lnBeginX + nHashCounter * nDistance + nHashWidth  + nHashWidth/2   , nHashTop + labellines.lnBeginY)
      poform.lovpe.tovpe.olevpe.AddPolygonPoint(oPolygon, -200 + tmpLabelLines.lnBeginX + nHashCounter * nDistance + nHashWidth/2                    , nHashTop + labellines.lnBeginY)
      
      nHashCounter = nHashCounter + 1
   ENDFOR
   poform.lovpe.tovpe.olevpe.pensize  = 0
ELSE
   poform.lovpe.tovpe.olevpe.BkgMode = VBKG_SOLID
   poform.lovpe.tovpe.olevpe.BkgColor = color_black
   poform.lovpe.tovpe.olevpe.pensize  = 1

   FOR nTeller = tmpLabelLines.lnBeginX TO tmpLabelLines.lnEndX  STEP nDistance
      oPolygon=poform.lovpe.tovpe.olevpe.Polygon(4)
      poform.lovpe.tovpe.olevpe.AddPolygonPoint(oPolygon, nHashTop + labellines.lnBeginY               , tmpLabelLines.lnBeginX + nHashCounter * nDistance                           )
      poform.lovpe.tovpe.olevpe.AddPolygonPoint(oPolygon, nHashTop + labellines.lnBeginY               , tmpLabelLines.lnBeginX + nHashCounter * nDistance + nHashWidth             )
      poform.lovpe.tovpe.olevpe.AddPolygonPoint(oPolygon, nHashTop - nHashHeight + labellines.lnBeginY   , tmpLabelLines.lnBeginX + nHashCounter * nDistance + nHashWidth  + nHashWidth/2)
      poform.lovpe.tovpe.olevpe.AddPolygonPoint(oPolygon, nHashTop - nHashHeight + labellines.lnBeginY   , tmpLabelLines.lnBeginX + nHashCounter * nDistance + nHashWidth/2            )
      
      nHashCounter = nHashCounter + 1
   ENDFOR
   poform.lovpe.tovpe.olevpe.pensize  = 0
ENDIF

poform.lovpe.tovpe.olevpe.BkgColor = color_white
RETURN

nc1264
 
Posts: 28
Joined: Mon Dec 13, 2004 8:18 am

Re: Objects not printed at proper location

Postby IDEAL Software Support » Tue Jun 21, 2011 11:35 am

This case is too complex to be handled in the scope of our free support through this forum. Please purchase premium support and contact our tech support by e-mail. Please note that VPE v3.50 is from 2002 and we can not make any fixes to the code, if there should be a problem in VPE.
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm


Return to VPE Open Forum

Who is online

Users browsing this forum: No registered users and 11 guests