VintaSoft PDF .NET Plug-in Discussions

Questions, comments and suggestions concerning VintaSoft PDF .NET Plug-in.

Board index < VintaSoft Imaging < VintaSoft PDF .NET Plug-in Discussions

We are migrating to new forums engine, no new registration or posting currently available. TIA for your patience.

Convert Adobe API code to C# with Vintasoft



Convert Adobe API code to C# with Vintasoft

Post by guillaume.corneau »

Hi,

We currently have an Adobe plugin and we currently use Vintasoft to replace this old Plugin to new desing interface. So our customers will not need to have Adobe Pro and they will save monthy fees.

All options are currently converted but I can't find a way to convert one of them.

This is a part of code I'll need to convert

We have two parts of code, one to set some status in PDF and another one to reset status (Revert the first part)

This is the first part of code (Set status)
PDPage page = PDDocAcquirePage(doc, pageNumber);         
PDEContent pdeContent = PDPageAcquirePDEContent(page, gExtensionID);
PDEPath path = createPageBolderPath(page, bolderWidth, bolderColor);
PDEContentAddElem(pdeContent, kPDEAfterLast, (PDEElement)path);
PDPageSetPDEContent(page, gExtensionID);
PDERelease((PDEObject)path);
PDPageReleasePDEContent(page, gExtensionID);


PDEPath JxStatusSetAction::createPageBolderPath(PDPage page, int width, QColor color) {
    PDEPath path = PDEPathCreate();
    ASFixedRect cropBox;
    PDPageGetCropBox(page, &cropBox);
    PDEPathSetPaintOp(path, kPDEStroke);
    PDEGraphicState state;
    memset(&state, 0, sizeof(PDEGraphicState));
    state.strokeColorSpec.space = PDEColorSpaceCreateFromName(ASAtomFromString("DeviceRGB"));
    state.strokeColorSpec.value.color[0] = ASFloatToFixed(color.redF());
    state.strokeColorSpec.value.color[1] = ASFloatToFixed(color.greenF());
    state.strokeColorSpec.value.color[2] = ASFloatToFixed(color.blueF());
    state.lineWidth = ASInt16ToFixed(width);
    state.miterLimit = fixedTen;
    state.flatness = fixedOne;
    PDEElementSetGState((PDEElement)path, &state, sizeof(PDEGraphicState));
    ASFixed pathData[5];
    pathData[0] = kPDERect;
    pathData[1] = cropBox.left;
    pathData[2] = cropBox.top;
    pathData[3] = cropBox.right - cropBox.left;
    pathData[4] = cropBox.bottom - cropBox.top;
    PDEPathSetData(path, pathData, sizeof(pathData));
    return path;
}
This is the second one (Reset status)
PDPage page = PDDocAcquirePage(doc, pageNumber);

// delete all last elements which are path. for old pdflyer it might has two paths
PDEContent pdeContent = PDPageAcquirePDEContent(page, gExtensionID);
while (true) {
    int pdeNumber = PDEContentGetNumElems(pdeContent);
    if (pdeNumber == 0) break;
    PDEElement element = PDEContentGetElem (pdeContent, pdeNumber - 1);
    if (PDEObjectGetType((PDEObject)element) != kPDEPath) break;
    PDEContentRemoveElem(pdeContent, pdeNumber - 1);
}
PDPageSetPDEContent(page, gExtensionID);
PDPageReleasePDEContent(page, gExtensionID);

PDPageRelease(page);
Someone could you help me to convert it ?

Thank you


Re: Convert Adobe API code to C# with Vintasoft

Post by Alex »

Hello Guillaume,

Our support team helped you to convert your code. I marking this topic as solved.

Best regards, Alexander


Page 1 from 1: 1