This is the code - I've removed the rectangle output as that seems to be working fine:
' Attempt to paint product rectangles onto the frontview Private Function ExportProductsFrontView(ByVal lSectionID As Long, ByVal SectionFrontViewRight As Single, ByVal SectionFrontViewX As Single, lastIndex As Long) As Long
Dim SupportFrontViewWidth As Single = modGlobals.Value.Zero ' Valid NEW or EXISTING planogram item id Dim lastProductNumber As Long = 0 Dim lCurrentProductIndex As Long = lastIndex Dim lRetVal As Long
Try If modManagement.ValidID(lSectionID) Then
Dim thisSupport As New clsSectionSupport thisSupport = FindSupportOnSection(lSectionID) Dim dblBoxRight As Double = 0 Dim dblTextLeft As Double = 0
' Draw products on the FrontView that do not overlap For Each oProduct In oExportPlanogram.Products.Where(Function(product) product.SectionID = lSectionID)
'--- If we change product number, increment the index and update the current product number --- If oProduct.ProductID <> lastProductNumber Then lastProductNumber = oProduct.ProductID lCurrentProductIndex += 1 End If
'--- Draw the product index number in a box And put it in the bottom left of the product --- Call modExportPlanogramSharp.TextOut(CInt(oProduct.FrontViewX) + 1, CInt(oProduct.FrontViewBottom) - 1, lCurrentProductIndex.ToString, 3)
Next ' Product
End If
Catch ex As Exception Throw New Exception(Reflection.MethodBase.GetCurrentMethod.Name & " : " & ex.Message) End Try
Return lCurrentProductIndex
End Function ' ExportProductsFrontView
Inside a module called modExportPlanogramSharp, there's the text out method: Friend Sub TextOut(dblX As Double, dblY As Double, sTextBox As String, Optional dblFontSize As Double = EXPORT_FONT_SIZE, Optional bBold As Boolean = False, Optional bItalic As Boolean = False, Optional bUnderline As Boolean = False, Optional bStrikeOut As Boolean = False) Try With pdfExportDocument
Dim objStyle As Object = GetFontStyle(bBold, bItalic, bUnderline, bStrikeOut) Dim xFont As XFont = New XFont(EXPORT_FONT_NAME, dblFontSize, DirectCast(objStyle, XFontStyle))
pdfGraphics.DrawString(sTextBox, xFont, XBrushes.Black, dblX, dblY)
End With Catch ex As Exception Call WriteErrorLogAndShowMessage(Reflection.MethodBase.GetCurrentMethod.Name, Err.Number, "MESSAGE_000XXX", "Did not draw textout.", ex.Message) End Try End Sub
A product record is included in the attachment.
Hopefully you can see that this is printing a black string into the PDF for every item in the list of products (~540) Sometimes, that XBrushes.Black is green or grey. I tried attaching the PDF but it only seems to accept images?
|