HeadlessChrome::savePrintScreen()

@return
512651
public function savePrintScreen($targetPath)
    {
        if (strtolower(pathinfo($targetPath, PATHINFO_EXTENSION)) === 'pdf') {
            return $this->savePdf($targetPath);
        }
        $this->callBrowser($this->createScreenshotCommand($targetPath));
        if (! file_exists($targetPath)) {
            throw CouldNotTakeBrowsershot::chromeOutputEmpty($targetPath);
        }
    }
1040554
public BasePanel makeSubScreen()
    {
        if (this.getHeaderRecord() instanceof UserGroup)
            return new UserGroupHeaderScreen(null, this, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null);
        else
            return new UserResourceHeaderScreen(null, this, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null);
    }
1281243
public function takeScreenshot($save_as = null)
    {
        $screenshot = base64_decode(
            $this->execute(DriverCommand::SCREENSHOT)
        );
        if ($save_as) {
            file_put_contents($save_as, $screenshot);
        }

        return $screenshot;
    }
649954
public boolean printData(PrintWriter out, int iPrintOptions)
    {
        String strFieldName = this.getScreenField().getSFieldParam();
        String strButtonDesc = ((SButtonBox)this.getScreenField()).getButtonDesc();
        if ((strButtonDesc == null)
            && (((SButtonBox)this.getScreenField()).getImageButtonName() != null))
        {
            if (this.getScreenField().getParentScreen() instanceof GridScreen)
            { // These are command buttons such as "Form" or "Detail"
                GridScreen gridScreen = (GridScreen)this.getScreenField().getParentScreen();
                Record record = gridScreen.getMainRecord();
                String strBookmark = DBConstants.BLANK;
                try {
                    strBookmark = record.getHandle(DBConstants.OBJECT_ID_HANDLE).toString();
                } catch (DBException ex)    {
                    ex.printStackTrace();
                }
                if (this.isSingleDataImage())
                	strBookmark = this.getScreenField().getConverter().toString();
                
                out.println("    " + Utility.startTag(strFieldName) + strBookmark + Utility.endTag(strFieldName));
                return true;
            }
            else
                return super.printData(out, iPrintOptions);
        }
        else
            return super.printData(out, iPrintOptions);
    }
1026661
public function copyChildless()
    {
        $new = $this->copyWithName();
        $new->setAction($this->getAction());
        $new->setMainRoute($this->getMainRoute());
        $new->setChildRoutes($this->getChildRoutes());
        $new->setEvent($this->getEvent());
        $new->setEventArguments($this->getEventArguments());
        $new->setIcon($this->getIcon());
        $new->setHeaderIcon($this->getHeaderIcon());
        $new->setHeaderTitle($this->getHeaderTitle());
        $new->setId($this->getId());
        $new->setHasSettings($this->getHasSettings());
        $new->setPosition($this->getPosition());
        $new->setLabel($this->getLabel());

        return $new;
    }
807001
def _onShortcutPrint(self):
        
        dialog = QPrintDialog(self)
        if dialog.exec_() == QDialog.Accepted:
            printer = dialog.printer()
            self.print_(printer)
1046355
public static function png($frame, $filename = false, $pixelPerPoint = 4, $outerFrame = 4,$saveandprint=FALSE)
    {
        $image = self::image($frame, $pixelPerPoint, $outerFrame);

        if ($filename === false) {
            Header("Content-type: image/png");
            ImagePng($image);
        } else {
            if($saveandprint===TRUE){
                ImagePng($image, $filename);
                header("Content-type: image/png");
                ImagePng($image);
            }else{
                ImagePng($image, $filename);
            }
        }

        ImageDestroy($image);
    }
856139
public function getPanel()
    {
        $this->stop();

        if ($this->isError) {
            return $this->renderError();
        }

        $parsingStart = \microtime(true);

        if (($traceFileSize = @\filesize($this->traceFile . '.xt')) <= \strlen(self::WRITE_OK)) {
            if ($traceFileSize === false) {
                $this->setError("Cannot read trace file '$this->traceFile.xt' size", \error_get_last());
            } elseif ($traceFileSize === 0) {
                $this->setError("Trace file '$this->traceFile.xt' is empty");
            } elseif (@\file_get_contents($this->traceFile . '.xt') === self::WRITE_OK) {
                $this->setError('Tracing did not start');
            }
        } elseif (($fd = @\fopen($this->traceFile . '.xt', 'rb')) === false) {
            $this->setError("Cannot open trace file '$this->traceFile.xt'", \error_get_last());
        } elseif (!\preg_match('/^Version: 2\..*/', (string) \fgets($fd, self::$traceLineLength))) {
            $this->setError('Trace file version line mischmasch');
        } elseif (!\preg_match('/^File format: [2-4]/', (string) \fgets($fd, self::$traceLineLength))) {
            $this->setError('Trace file format line mischmasch');
        } else {
            while (($line = \fgets($fd, self::$traceLineLength)) !== false) {
                if (\strpos($line, 'TRACE START') === 0) {    // TRACE START line
                    $this->openTrace();

                } elseif (\strpos($line, 'TRACE END') === 0) {    // TRACE END line
                    $this->closeTrace();

                } elseif ($this->isTraceOpened()) {
                    $line = \rtrim($line, "\r\n");

                    $cols = \explode("\t", $line);
                    if (!\strlen($cols[0]) && \count($cols) === 5) {    // last line before TRACE END
                        continue;
                    }

                    $record = (object) [
                        'level' => (int) $cols[0],
                        'id' => (float) $cols[1],
                        'isEntry' => !$cols[2],
                        'exited' => false,
                        'time' => (float) $cols[3],
                        'exitTime' => null,
                        'deltaTime' => null,
                        'memory' => (float) $cols[4],
                        'exitMemory' => null,
                        'deltaMemory' => null,
                    ];

                    if ($record->isEntry) {
                        $record->function = $cols[5];
                        $record->isInternal = !$cols[6];
                        $record->includeFile = \strlen($cols[7]) ? $cols[7] : null;
                        $record->filename = $cols[8];
                        $record->line = $cols[9];
                        $record->evalInfo = '';

                        if (\strcmp(\substr($record->filename, -13), "eval()'d code") === 0) {
                            \preg_match('/(.*)\(([0-9]+)\) : eval\(\)\'d code$/', $record->filename, $match);
                            $record->evalInfo = "- eval()'d code ($record->line)";
                            $record->filename = $match[1];
                            $record->line = $match[2];
                        }
                    }

                    $this->addRecord($record);
                }
            }

            $this->closeTrace();  // in case of non-complete trace file
        }

        if ($this->isError) {
            return $this->renderError();
        }

        $traces = $this->traces;
        $indents = $this->indents;
        $titles = $this->titles;
        $parsingTime = \microtime(true) - $parsingStart;

        if ($this->performStatistics) {
            $statistics = $this->statistics;
        }

        \ob_start(null, 0, PHP_OUTPUT_HANDLER_REMOVABLE);
        require __DIR__ . '/templates/trace.panel.phtml';

        return \ob_get_clean();
    }
284074
public AppletScreen getAppletScreen()
    {
        AppletScreen appletScreen = null;
        if (this.getSFieldCount() > 0)
            appletScreen = (AppletScreen)this.getSField(0);
        return appletScreen;
    }
1006695
protected function setBackground()
    {
        // set background color of image by drawing a rectangle since imagecreatetruecolor doesn't set a bg color
        imagefilledrectangle($this->im, 0, 0,
                             $this->image_width, $this->image_height,
                             $this->gdbgcolor);

        if ($this->perturbation > 0) {
            imagefilledrectangle($this->tmpimg, 0, 0,
                                 $this->image_width * $this->iscale, $this->image_height * $this->iscale,
                                 $this->gdbgcolor);
        }

        if ($this->bgimg == '') {
            if ($this->background_directory != null &&
                is_dir($this->background_directory) &&
                is_readable($this->background_directory))
            {
                $img = $this->getBackgroundFromDirectory();
                if ($img != false) {
                    $this->bgimg = $img;
                }
            }
        }

        if ($this->bgimg == '') {
            return;
        }

        $dat = @getimagesize($this->bgimg);
        if($dat == false) {
            return;
        }

        switch($dat[2]) {
            case 1:  $newim = @imagecreatefromgif($this->bgimg); break;
            case 2:  $newim = @imagecreatefromjpeg($this->bgimg); break;
            case 3:  $newim = @imagecreatefrompng($this->bgimg); break;
            default: return;
        }

        if(!$newim) return;

        imagecopyresized($this->im, $newim, 0, 0, 0, 0,
                         $this->image_width, $this->image_height,
                         imagesx($newim), imagesy($newim));
    }
696637
public String getScreenURL()
    {
        String strURL = super.getScreenURL();
        if (this.getClass().getName().equals(Screen.class.getName()))
        {
            strURL = this.addURLParam(strURL, DBParams.RECORD, this.getMainRecord().getClass().getName());
            strURL = this.addURLParam(strURL, DBParams.COMMAND, ThinMenuConstants.FORM);
        }
        else
            strURL = this.addURLParam(strURL, DBParams.SCREEN, this.getClass().getName());
        try   {
            if (this.getMainRecord() != null)
                if ((this.getMainRecord().getEditMode() == Constants.EDIT_IN_PROGRESS) || (this.getMainRecord().getEditMode() == Constants.EDIT_CURRENT))
                {
                    String strBookmark = DBConstants.BLANK;
                    if (this.getMainRecord().getHandle(DBConstants.OBJECT_ID_HANDLE) != null)
                        strBookmark = this.getMainRecord().getHandle(DBConstants.OBJECT_ID_HANDLE).toString();
                    strURL = this.addURLParam(strURL, DBConstants.STRING_OBJECT_ID_HANDLE, strBookmark);
                }
        } catch (DBException ex)    {
            ex.printStackTrace();
        }
        return strURL;
    }
827314
public static function borderless()
    {
        if (!self::$borderless) {
            self::$borderless = new static();
            self::$borderless->borderStyle = BorderStyle::none();
            self::$borderless->borderStyle->setLineHCChar('=');
            self::$borderless->borderStyle->setLineVCChar(' ');
            self::$borderless->borderStyle->setCrossingCChar(' ');
        }

        return clone self::$borderless;
    }
771665
private void createPrintContactsSubForm() {
		add(new WHeading(HeadingLevel.H3, "Print to CSV"));

		WButton printBtn = new WButton("Print");
		printBtn.setAction(new Action() {
			@Override
			public void execute(final ActionEvent event) {
				printDetails();
			}
		});
		printBtn.setImage("/image/document-print.png");
		printBtn.setImagePosition(WButton.ImagePosition.EAST);

		WFieldLayout layout = new WFieldLayout();
		add(layout);
		layout.setMargin(new Margin(Size.LARGE, null, null, null));
		layout.addField("Print output", printOutput);
		layout.addField((WLabel) null, printBtn);
		add(new WAjaxControl(printBtn, printOutput));
	}
223790
public void printDisplayControl(PrintWriter out)
    {
        if (this.getScreenField().getConverter() == null)
            return;
        String strField = Utility.encodeXML(this.getScreenField().getSFieldValue(true, false));
        if ((strField == null) || (strField.length() == 0))
            strField = "&nbsp;";    //?"<br>";
        String strHyperlink = ((Converter)this.getScreenField().getConverter()).getHyperlink();
        if (strHyperlink != null) if (strHyperlink.length() > 0)
            strField = "<a href=\"" + strHyperlink + "\">" + strField + "<a>";
        String strAlignment = this.getControlAlignment();
        out.println("<td" + strAlignment + ">" + strField + "</td>");
    }
160511
void repaintScreen() {
        int repaintLine = 1;
        console.out().print(ansi().eraseScreen(Erase.ALL));
        console.out().print(ansi().cursor(1, 1));
        console.out().print("\33[" + (getHeaderSize() + 1) + ";" + (terminal.getHeight() - getFooterSize()) + ";r");
        redrawHeader();
        redrawFooter();
        LinkedList<String> linesToDisplay = new LinkedList<String>();
        int l = 1;
        while (linesToDisplay.size() < terminal.getHeight() - getFooterSize()) {
            String currentLine = getContent(l++);
            linesToDisplay.addAll(toDisplayLines(currentLine));
        }

        for (int i = 0; i < terminal.getHeight() - getHeaderSize() - getFooterSize(); i++) {
            console.out().print(ansi().cursor(repaintLine + getHeaderSize(), 1));
            displayText(linesToDisplay.get(i));
            repaintLine++;
        }
        console.out().print(ansi().cursor(2, 1));
    }
248660
public function save()
    {
        $result = true;

        if (!empty($this->changedData)) {
            foreach ($this->changedData as $scope => $rowData) {
                foreach ($rowData as $layoutName => $layoutData) {
                    if (empty($scope) || empty($layoutName)) {
                        continue;
                    }
                    $layoutPath = $this->getLayoutPath($scope, true);
                    $data = Json::encode($layoutData, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);

                    $result &= $this->getFileManager()->putContents(array($layoutPath, $layoutName.'.json'), $data);
                }
            }
        }

        if ($result == true) {
            $this->clearChanges();
        }

        return (bool) $result;
    }
171750
private void silentlySaveScreenshotTo(final File file) {
		try {
			saveScreenshotTo(file);
			LOG.info("Screenshot saved: " + file.getAbsolutePath());
		} catch (Exception e) {
			LOG.warn("Error while taking screenshot " + file.getName() + ": "
					+ e);
		}
	}